Пример #1
0
        public void ShowCourse(View v)
        {
            if (courseList != null && courseList.Any())
            {
                if (popCourse == null)
                {
                    View                popViwe3  = LayoutInflater.Inflate(Resource.Layout.popup_select1, null);
                    ListView            listview3 = popViwe3.FindViewById <ListView>(Resource.Id.lv);
                    CourseSelectAdapter adaptera  = new CourseSelectAdapter(CurrActivity, courseList);
                    adaptera.SetSelectedValue(searchCourse);
                    listview3.Adapter = adaptera;

                    popCourse                  = new PopupWindow(popViwe3, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    popCourse.Touchable        = true;
                    popCourse.Focusable        = true;
                    popCourse.OutsideTouchable = true;;
                    popCourse.SetBackgroundDrawable(new BitmapDrawable());

                    popCourse.DismissEvent += (sender, e) =>
                    {
                        tv_course.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                        var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                        arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                        tv_course.SetCompoundDrawables(null, null, arrowDown, null);
                    };

                    listview3.ItemClick += (sender, e) =>
                    {
                        searchCourse   = this.courseList[e.Position];
                        tv_course.Text = searchCourse;

                        popCourse.Dismiss();

                        adaptera.SetSelectedValue(searchCourse);
                        adaptera.NotifyDataSetChanged();

                        BindData();
                    };
                }
                if (!popCourse.IsShowing)
                {
                    tv_course.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                    var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                    arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                    tv_course.SetCompoundDrawables(null, null, arrowDownOn, null);

                    if ((int)(Build.VERSION.SdkInt) >= 24)
                    {
                        int[] a = new int[2];
                        v.GetLocationInWindow(a);
                        popCourse.ShowAtLocation(Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                    }
                    else
                    {
                        popCourse.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                    }
                }
            }
        }
Пример #2
0
        public void OnClick(View v)
        {
            if (v.Id == Resource.Id.tv_year)
            {
                #region Quarter
                if (quarterList != null && quarterList.Any())
                {
                    if (popYear == null)
                    {
                        View                 popViwe1  = layoutInflater.Inflate(Resource.Layout.popup_select1, null);
                        ListView             listview1 = popViwe1.FindViewById <ListView>(Resource.Id.lv);
                        QuarterSelectAdapter adaptera  = new QuarterSelectAdapter(CurrActivity, quarterList);
                        adaptera.SetSelectedValue(searchQuarter.QuarterName);
                        listview1.Adapter = adaptera;

                        popYear                  = new PopupWindow(popViwe1, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popYear.Touchable        = true;
                        popYear.Focusable        = true;
                        popYear.OutsideTouchable = false;
                        popYear.SetBackgroundDrawable(new BitmapDrawable());

                        popYear.DismissEvent += (sender, e) =>
                        {
                            tv_year.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_year.SetCompoundDrawables(null, null, arrowDown, null);
                        };
                        //每一行的点击事件
                        listview1.ItemClick += (sender, e) =>
                        {
                            searchQuarter = this.quarterList[e.Position];
                            tv_year.Text  = searchQuarter.QuarterName;

                            popYear.Dismiss();

                            adaptera.SetSelectedValue(searchQuarter.QuarterName);
                            adaptera.NotifyDataSetChanged();

                            BindData();
                        };
                    }
                    if (!popYear.IsShowing)
                    {
                        tv_year.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_year.SetCompoundDrawables(null, null, arrowDownOn, null);

                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popYear.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popYear.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
            else if (v.Id == Resource.Id.tv_district)
            {
                #region Distirct
                if (districtList != null && districtList.Any())
                {
                    if (popDistrict == null)
                    {
                        View     popViwe3              = layoutInflater.Inflate(Resource.Layout.popup_select1, null);
                        ListView listview3             = popViwe3.FindViewById <ListView>(Resource.Id.lv);
                        DistrictSelectAdapter adaptera = new DistrictSelectAdapter(CurrActivity, districtList);
                        adaptera.SetSelectedValue(searchDistrict);
                        listview3.Adapter = adaptera;

                        popDistrict                  = new PopupWindow(popViwe3, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popDistrict.Touchable        = true;
                        popDistrict.Focusable        = true;
                        popDistrict.OutsideTouchable = true;;
                        popDistrict.SetBackgroundDrawable(new BitmapDrawable());

                        popDistrict.DismissEvent += (sender, e) =>
                        {
                            tv_district.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_district.SetCompoundDrawables(null, null, arrowDown, null);
                        };
                        //每一行的点击事件
                        listview3.ItemClick += (sender, e) =>
                        {
                            searchDistrict   = this.districtList[e.Position];
                            tv_district.Text = searchDistrict;

                            popDistrict.Dismiss();

                            adaptera.SetSelectedValue(searchDistrict);
                            adaptera.NotifyDataSetChanged();

                            BindData();
                        };
                    }
                    if (!popDistrict.IsShowing)
                    {
                        tv_district.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_district.SetCompoundDrawables(null, null, arrowDownOn, null);

                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popDistrict.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popDistrict.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
            else if (v.Id == Resource.Id.tv_category)
            {
                #region Category
                if (categoryList != null && categoryList.Any())
                {
                    if (popCategory == null)
                    {
                        View                popViwe3  = layoutInflater.Inflate(Resource.Layout.popup_select1, null);
                        ListView            listview3 = popViwe3.FindViewById <ListView>(Resource.Id.lv);
                        CourseSelectAdapter adaptera  = new CourseSelectAdapter(CurrActivity, categoryList);
                        adaptera.SetSelectedValue(searchCagetory);
                        listview3.Adapter = adaptera;

                        popCategory                  = new PopupWindow(popViwe3, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popCategory.Touchable        = true;
                        popCategory.Focusable        = true;
                        popCategory.OutsideTouchable = true;;
                        popCategory.SetBackgroundDrawable(new BitmapDrawable());

                        popCategory.DismissEvent += (sender, e) =>
                        {
                            tv_cagetory.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_cagetory.SetCompoundDrawables(null, null, arrowDown, null);
                        };

                        listview3.ItemClick += (sender, e) =>
                        {
                            searchCagetory   = this.categoryList[e.Position];
                            tv_cagetory.Text = searchCagetory;

                            popCategory.Dismiss();

                            adaptera.SetSelectedValue(searchCagetory);
                            adaptera.NotifyDataSetChanged();

                            BindData();
                        };
                    }
                    if (!popCategory.IsShowing)
                    {
                        tv_cagetory.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_cagetory.SetCompoundDrawables(null, null, arrowDownOn, null);

                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popCategory.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popCategory.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
        }
Пример #3
0
        public void OnClick(View v)
        {
            if (v.Id == Resource.Id.tv_year)
            {
                #region Quarter
                if (quarterList != null && quarterList.Any())
                {
                    if (popYear == null)
                    {
                        View                 popViwe1  = layoutInflater.Inflate(Resource.Layout.popup_select1, null);
                        ListView             listview1 = popViwe1.FindViewById <ListView>(Resource.Id.lv);
                        QuarterSelectAdapter adaptera  = new QuarterSelectAdapter(CurrActivity, quarterList);
                        adaptera.SetSelectedValue(searchQuarter.QuarterName);
                        listview1.Adapter = adaptera;

                        popYear                  = new PopupWindow(popViwe1, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popYear.Touchable        = true;
                        popYear.Focusable        = true;
                        popYear.OutsideTouchable = false;
                        popYear.SetBackgroundDrawable(new BitmapDrawable());

                        popYear.DismissEvent += (sender, e) =>
                        {
                            tv_year.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_year.SetCompoundDrawables(null, null, arrowDown, null);
                        };
                        //每一行的点击事件
                        listview1.ItemClick += (sender, e) =>
                        {
                            searchQuarter = this.quarterList[e.Position];
                            tv_year.Text  = searchQuarter.QuarterName;

                            popYear.Dismiss();

                            adaptera.SetSelectedValue(searchQuarter.QuarterName);
                            adaptera.NotifyDataSetChanged();

                            BindData();
                        };
                    }
                    if (!popYear.IsShowing)
                    {
                        tv_year.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_year.SetCompoundDrawables(null, null, arrowDownOn, null);

                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popYear.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popYear.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
            else if (v.Id == Resource.Id.tv_district)
            {
                #region Distirct
                if (districtList != null && districtList.Any())
                {
                    if (popDistrict == null)
                    {
                        View     popViwe3              = layoutInflater.Inflate(Resource.Layout.popup_select1, null);
                        ListView listview3             = popViwe3.FindViewById <ListView>(Resource.Id.lv);
                        DistrictSelectAdapter adaptera = new DistrictSelectAdapter(CurrActivity, districtList);
                        adaptera.SetSelectedValue(searchDistrict);
                        listview3.Adapter = adaptera;

                        popDistrict                  = new PopupWindow(popViwe3, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popDistrict.Touchable        = true;
                        popDistrict.Focusable        = true;
                        popDistrict.OutsideTouchable = true;;
                        popDistrict.SetBackgroundDrawable(new BitmapDrawable());

                        popDistrict.DismissEvent += (sender, e) =>
                        {
                            tv_district.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_district.SetCompoundDrawables(null, null, arrowDown, null);
                        };
                        //每一行的点击事件
                        listview3.ItemClick += (sender, e) =>
                        {
                            searchDistrict   = this.districtList[e.Position];
                            tv_district.Text = searchDistrict;

                            popDistrict.Dismiss();

                            adaptera.SetSelectedValue(searchDistrict);
                            adaptera.NotifyDataSetChanged();

                            BindData();
                        };
                    }
                    if (!popDistrict.IsShowing)
                    {
                        tv_district.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_district.SetCompoundDrawables(null, null, arrowDownOn, null);

                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popDistrict.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popDistrict.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
            else if (v.Id == Resource.Id.tv_grade)
            {
                #region Grade
                if (gradeList != null && gradeList.Any())
                {
                    if (popGrade == null)
                    {
                        View   popViwe2 = layoutInflater.Inflate(Resource.Layout.popup_grade, null);
                        Button btnOk    = popViwe2.FindViewById <Button>(Resource.Id.btn_ok);

                        var screenWidth  = Resources.DisplayMetrics.WidthPixels;
                        var wrapperWidth = screenWidth - AppUtils.dip2px(CurrActivity, 24);
                        var itemWidth    = (int)Math.Round((wrapperWidth / 4) * 0.8);
                        var marginRight  = (wrapperWidth - itemWidth * 4) / 3;

                        var tvAll = popViwe2.FindViewById <TextView>(Resource.Id.tv_all);
                        ViewGroup.LayoutParams tvallParams = tvAll.LayoutParameters;
                        tvallParams.Width      = itemWidth;
                        tvAll.LayoutParameters = tvallParams;

                        GridLayout gridlayout_1 = popViwe2.FindViewById <GridLayout>(Resource.Id.gridlayout_1);
                        for (var i = 0; i < gradeList.Count; i++)
                        {
                            TextView tvGrade   = new TextView(CurrActivity);
                            var      itemGrade = gradeList[i];
                            GridLayout.LayoutParams gradeParams = new GridLayout.LayoutParams();
                            gradeParams.Width = itemWidth;
                            //parasBox.Height =
                            if (i % 4 != 3)
                            {
                                gradeParams.RightMargin = marginRight;
                            }
                            gradeParams.TopMargin    = AppUtils.dip2px(CurrActivity, 5);
                            gradeParams.BottomMargin = AppUtils.dip2px(CurrActivity, 5);
                            tvGrade.LayoutParameters = gradeParams;
                            tvGrade.Text             = itemGrade;
                            tvGrade.TextSize         = 14;
                            tvGrade.Gravity          = GravityFlags.Center;
                            tvGrade.Background       = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg_on);
                            tvGrade.SetPadding(0, AppUtils.dip2px(CurrActivity, 5), 0, AppUtils.dip2px(CurrActivity, 5));
                            tvGrade.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));

                            gridlayout_1.AddView(tvGrade);

                            #region tvGrade.Click
                            tvGrade.Click += (sender, e) =>
                            {
                                if (!searchGradeList.Contains(itemGrade))
                                {
                                    searchGradeList.Add(itemGrade);

                                    tvGrade.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                                    tvGrade.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg_on);
                                }
                                else
                                {
                                    searchGradeList.Remove(itemGrade);

                                    tvGrade.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorSecond)));
                                    tvGrade.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg);

                                    tvAll.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorSecond)));
                                    tvAll.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg);
                                }

                                //控制全部年级按钮颜色
                                if (gradeList.Count == searchGradeList.Count)
                                {
                                    tvAll.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                                    tvAll.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg_on);
                                }
                                //控制确定按钮是否可用
                                if (searchGradeList.Count == 0)
                                {
                                    btnOk.Enabled = false;
                                    btnOk.SetBackgroundResource(Resource.Drawable.button_bg_disabled);
                                }
                                else
                                {
                                    btnOk.Enabled = true;
                                    btnOk.SetBackgroundResource(Resource.Drawable.button_bg);
                                }
                            };
                        }
                        #endregion

                        #region tvAll.Click
                        tvAll.Click += (sender, e) =>
                        {
                            if (tvAll.CurrentTextColor == ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh))
                            {
                                tvAll.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorSecond)));
                                tvAll.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg);

                                for (var i = 0; i < gridlayout_1.ChildCount; i++)
                                {
                                    var tv = (TextView)gridlayout_1.GetChildAt(i);
                                    tv.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorSecond)));
                                    tv.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg);
                                }
                                searchGradeList = new List <string>();
                            }
                            else
                            {
                                tvAll.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                                tvAll.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg_on);

                                for (var i = 0; i < gridlayout_1.ChildCount; i++)
                                {
                                    var tv = (TextView)gridlayout_1.GetChildAt(i);
                                    tv.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                                    tv.Background = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.textview_bg_on);
                                }
                                searchGradeList = new List <string>(gradeList.ToArray());
                            }

                            //控制确定按钮是否可用
                            if (searchGradeList.Count == 0)
                            {
                                btnOk.Enabled = false;
                                btnOk.SetBackgroundResource(Resource.Drawable.button_bg_disabled);
                            }
                            else
                            {
                                btnOk.Enabled = true;
                                btnOk.SetBackgroundResource(Resource.Drawable.button_bg);
                            }
                        };
                        #endregion

                        #region btnOK.Click
                        btnOk.Click += (sender, e) =>
                        {
                            popGrade.Dismiss();
                            var selectedgrade = "全部年级";
                            if (searchGradeList.Count != gradeList.Count)
                            {
                                selectedgrade = string.Join(",", searchGradeList.ToArray());
                            }

                            tv_grade.Text = selectedgrade;

                            BindData();
                        };
                        #endregion

                        popGrade                  = new PopupWindow(popViwe2, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popGrade.Touchable        = true;
                        popGrade.Focusable        = true;
                        popGrade.OutsideTouchable = true;;
                        popGrade.SetBackgroundDrawable(new BitmapDrawable());

                        popGrade.DismissEvent += (sender, e) =>
                        {
                            tv_grade.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_grade.SetCompoundDrawables(null, null, arrowDown, null);
                        };
                    }
                    if (!popGrade.IsShowing)
                    {
                        tv_grade.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_grade.SetCompoundDrawables(null, null, arrowDownOn, null);


                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popGrade.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popGrade.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
            else if (v.Id == Resource.Id.tv_course)
            {
                #region Course
                if (courseList != null && courseList.Any())
                {
                    if (popCourse == null)
                    {
                        View                popViwe3  = layoutInflater.Inflate(Resource.Layout.popup_select1, null);
                        ListView            listview3 = popViwe3.FindViewById <ListView>(Resource.Id.lv);
                        CourseSelectAdapter adaptera  = new CourseSelectAdapter(CurrActivity, courseList);
                        adaptera.SetSelectedValue(searchCourse);
                        listview3.Adapter = adaptera;

                        popCourse                  = new PopupWindow(popViwe3, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                        popCourse.Touchable        = true;
                        popCourse.Focusable        = true;
                        popCourse.OutsideTouchable = true;;
                        popCourse.SetBackgroundDrawable(new BitmapDrawable());

                        popCourse.DismissEvent += (sender, e) =>
                        {
                            tv_course.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorPrimary)));
                            var arrowDown = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down);
                            arrowDown.SetBounds(0, 0, arrowDown.MinimumWidth, arrowDown.MinimumHeight);
                            tv_course.SetCompoundDrawables(null, null, arrowDown, null);
                        };

                        listview3.ItemClick += (sender, e) =>
                        {
                            searchCourse   = this.courseList[e.Position];
                            tv_course.Text = searchCourse;

                            popCourse.Dismiss();

                            adaptera.SetSelectedValue(searchCourse);
                            adaptera.NotifyDataSetChanged();

                            //Toast.MakeText(CurrActivity, searchCourse, ToastLength.Short).Show();
                            BindData();
                        };
                    }
                    if (!popCourse.IsShowing)
                    {
                        tv_course.SetTextColor(new Color(ContextCompat.GetColor(CurrActivity, Resource.Color.textColorHigh)));
                        var arrowDownOn = AppUtils.GetDrawable(CurrActivity, Resource.Drawable.arrow_down_on);
                        arrowDownOn.SetBounds(0, 0, arrowDownOn.MinimumWidth, arrowDownOn.MinimumHeight);
                        tv_course.SetCompoundDrawables(null, null, arrowDownOn, null);

                        if ((int)(Build.VERSION.SdkInt) >= 24)
                        {
                            int[] a = new int[2];
                            v.GetLocationInWindow(a);
                            popCourse.ShowAtLocation(this.Activity.Window.DecorView, GravityFlags.NoGravity, 0, a[1] + v.Height + AppUtils.dip2px(CurrActivity, 11));
                        }
                        else
                        {
                            popCourse.ShowAsDropDown(v, 0, AppUtils.dip2px(CurrActivity, 11));
                        }
                    }
                }
                #endregion
            }
        }