Exemple #1
0
 public void OnPageChanged(AXEmojiPager emojiPager, AXEmojiBase @base, int position)
 {
     try
     {
         Drawable drawable;
         if (AXEmojiManager.IsAXEmojiView(@base))
         {
             drawable = AppCompatResources.GetDrawable(Context, Resource.Drawable.emoji_backspace);
             Utils.EnableBackspaceTouch(Footer, emojiPager.EditText);
             Footer.SetOnClickListener(null);
         }
         else
         {
             drawable = AppCompatResources.GetDrawable(Context, Resource.Drawable.ic_action_search);
             Footer.SetOnTouchListener(null);
             Footer.SetOnClickListener(this);
         }
         DrawableCompat.SetTint(DrawableCompat.Wrap(drawable), AXEmojiManager.EmojiViewTheme.FooterItemColor);
         Img.SetImageDrawable(drawable);
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
Exemple #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View   view   = inflater.Inflate(Resource.Layout.Fragment3, container, false);
            Button button = view.FindViewById <Button>(Resource.Id.btnFragment4);

            mFragment4Container = view.FindViewById <FrameLayout>(Resource.Id.fragment4Container);

            var trans = ChildFragmentManager.BeginTransaction();

            trans.Add(mFragment4Container.Id, new Fragment6(), "Fragment 6");
            trans.Commit();

            button.Click += (object sender, EventArgs e) =>
            {
                if (mFragment4Container.TranslationY + 2 >= mFragment4Container.Height)
                {
                    var interpolator = new Android.Views.Animations.OvershootInterpolator(5);
                    mFragment4Container.Animate().SetInterpolator(interpolator)
                    .TranslationYBy(-200)
                    .SetDuration(500);
                }
            };

            mFragment4Container.SetOnTouchListener(this);
            return(view);
        }
Exemple #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);

            View View = inflater.Inflate(Resource.Layout.MainWindow,container,false);

             PopUpContainer = View.FindViewById<FrameLayout>(Resource.Id.PopUpContainer);

            var transaction = Activity.SupportFragmentManager.BeginTransaction();
            transaction.Add(PopUpContainer.Id,new InventorySlideIn(),"InventorySlideIn");
            transaction.Commit();

            ImageButton PopUpButton = View.FindViewById<ImageButton>(Resource.Id.button_stats);

            PopUpButton.Click+= (object sender, EventArgs e) => {
                //erstellen des Statistiken Popups
                StatsPopUp optionPopUp = new StatsPopUp();
                Android.App.FragmentTransaction popuptransaction = Activity.FragmentManager.BeginTransaction();
                optionPopUp.Show(popuptransaction, "StatsPopUp");
            };

            PopUpContainer.SetOnTouchListener(this);

            Button PlayButton = View.FindViewById<Button>(Resource.Id.button_play);
            PlayButton.Click += (object sender, EventArgs e) => {
                if(startGameEvent != null)
                    startGameEvent(this, new EventArgs());
                //bindet den "Spielen" Button an die Spielen Anwendung
                //(Variablen)
            };

            return View;
        }
        /*
         *
         * Initilization method for android activity.
         *
         */

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.main);

            #region getting View ids

            _rootLayout = FindViewById <FrameLayout>(Resource.Id.root_layout);
            _title      = FindViewById <TextView>(Resource.Id.title);
            _title.SetTextColor(GlobalMethods.GetRandomColor());
            _title.SetBackgroundColor(Color.Transparent);
            _rootLayout.SetBackgroundColor(Color.White);
            _rootLayout.SetOnTouchListener(this);

            #endregion

            #region Creating animation for actionbar title

            var animation = AnimationUtils.LoadAnimation(this, Resource.Animation.slide_in_left
                                                         );
            animation.Duration = 5000;
            animation.SetAnimationListener(this);
            _title.Text = Title;
            _title.StartAnimation(animation);

            #endregion

            #region Register this as a listener with the underlying service for detecting Shaking of device.

            var sensorManager = GetSystemService(SensorService) as SensorManager;
            if (sensorManager != null)
            {
                var sensor = sensorManager.GetDefaultSensor(SensorType.Accelerometer);
                sensorManager.RegisterListener(this, sensor, SensorDelay.Game);
            }

            #endregion


            #region   Get max available VM memory, exceeding this amount will throw an OutOfMemory exception. Stored in kilobytes as LruCache takes an int in its constructor.

            var maxMemory = (int)(Java.Lang.Runtime.GetRuntime().MaxMemory() / 1024);

            // Use 1/8th of the available memory for this memory cache.
            int cacheSize = maxMemory / 8;

            _memoryCache = new MemoryLimitedLruCache(cacheSize);

            #endregion
        }
Exemple #5
0
        private void MyGoogleMap_MarkerClick(object sender, GoogleMap.MarkerClickEventArgs e)
        {
            if (busesInformation != null && busesInformation.Count != 0)
            {
                busInfoSender.SendBus(busesInformation[int.Parse(e.Marker.Title)]);
            }

            if (fragmentContainer.TranslationY + 20 >= fragmentContainer.Height)
            {
                var interpolator = new Android.Views.Animations.OvershootInterpolator(5);
                fragmentContainer.Animate().SetInterpolator(interpolator)
                .TranslationYBy(-200)
                .SetDuration(500);
            }
            fragmentContainer.SetOnTouchListener(this);
        }
        //need to make this call async to make responsive screen
        private async void BindVehicleImages()
        {
            if (CommonFunctions.IsNetworkConnected())
            {
                Java.IO.File _dir;
                //Environment.DirectoryPictures = "Images";
                _dir = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory + "/RentACar" + "/" + rentRunningTrans.RegNo);

                //km12akk
                // Get the latitude and longitude entered by the user and create a query.km12akk";//
                //string url = "https://uk1.ukvehicledata.co.uk/api/datapackage/VehicleImageData?v=2&api_nullitems=1&auth_apikey=a418b0ad-33ab-4953-9a00-9d3ea8a12319&key_VRM=" + rentRunningTrans.RegNo;

                // Fetch the vehicle information asynchronously,
                // parse the results, then update the screen:
                // objVehicleImageList = await GetVehicleImagesfromAPIAsync(url);
                // _markdamage.SetBackgroundResource(Resource.Drawable.UK1);
                // ParseAndDisplay (json);
                //this.progressLayout.Visibility = ViewStates.Visible;

                _layoutVehicleImages = FindViewById <LinearLayout>(Resource.Id.layoutVehicleImages);
                //if (objVehicleImageList != null)
                {
                    if (_dir.Exists() && _dir.ListFiles().Count() > 0)
                    {
                        Java.IO.File[] _objVehicleImageList = _dir.ListFiles();
                        //Needed to uncommment
                        for (int i = 0; i < _objVehicleImageList.Count(); i++)
                        //for (int i = 0; i < 6; i++)
                        {
                            ImageView imgVehicle = new ImageView(this);
                            imgVehicle.SetMaxWidth(60);
                            imgVehicle.SetMaxHeight(60);
                            imgVehicle.LayoutParameters = new LinearLayout.LayoutParams(150, 150);
                            imgVehicle.Visibility       = ViewStates.Visible;
                            imgVehicle.Id = i + 1;
                            //var imageBitmap =CommonFunctions.GetBitmapFromUrl(objVehicleImageList.Response.DataItems.VehicleImages.ImageDetailsList[i].ImageUrl);
                            // imgVehicle.SetImageBitmap(imageBitmap);
                            imgVehicle.SetImageURI(Android.Net.Uri.Parse(_objVehicleImageList[i].AbsolutePath));
                            //imgVehicle.SetBackgroundResource(Resource.Drawable.CarExterior);
                            imgVehicle.SetOnClickListener(this);
                            // add into my parent view
                            _layoutVehicleImages.AddView(imgVehicle);
                        }
                        //objVehicleImageList["DataItems"]["VehicleImages"]["ImageDetailsList"]
                    }
                    else
                    {
                        try
                        {
                            ImageView imgVehicle = new ImageView(this);
                            imgVehicle.SetMaxWidth(60);
                            imgVehicle.SetMaxHeight(60);
                            LinearLayout.LayoutParams obj = new LinearLayout.LayoutParams(150, 150);
                            obj.SetMargins(5, 5, 5, 5);
                            //imgVehicle.LayoutParameters  = new LinearLayout.LayoutParams(150, 150);
                            imgVehicle.Visibility = ViewStates.Visible;
                            // LinearLayout.LayoutParams obj = new LinearLayout.LayoutParams(100, 100);
                            //obj.SetMargins(5,5,5,5);
                            imgVehicle.LayoutParameters = obj;

                            if (rentRunningTrans.VehicleType == "Car")
                            {
                                imgVehicle.Id = 101;
                                imgVehicle.SetBackgroundResource(Resource.Drawable.CarExterior);

                                imgVehicle.SetOnClickListener(this);
                                //imgVehicle.SetPadding(10, 10, 10, 10);

                                // add into my parent view
                                _layoutVehicleImages.AddView(imgVehicle);

                                ImageView imgVehicleInterior = new ImageView(this);
                                imgVehicleInterior.SetMaxWidth(60);
                                imgVehicleInterior.SetMaxHeight(60);
                                //LinearLayout.LayoutParams objj = new LinearLayout.LayoutParams(150, 150);
                                //obj.SetMargins(5, 5, 5, 5);
                                imgVehicleInterior.LayoutParameters = obj;
                                // imgVehicleInterior.LayoutParameters = new LinearLayout.LayoutParams(150, 150);
                                imgVehicleInterior.Visibility = ViewStates.Visible;
                                imgVehicleInterior.Id         = 102;
                                imgVehicleInterior.SetBackgroundResource(Resource.Drawable.VehicleInteriorImg);
                                imgVehicleInterior.SetOnClickListener(this);
                                //imgVehicleInterior.SetPadding(10, 10, 10, 10);
                                _layoutVehicleImages.AddView(imgVehicleInterior);
                                _markdamage.SetBackgroundResource(Resource.Drawable.CarExterior);
                                iCurrentDamageImageId = 101;
                            }
                            else if (rentRunningTrans.VehicleType == "Luton Van")
                            {
                                imgVehicle.Id = 201;
                                imgVehicle.SetBackgroundResource(Resource.Drawable.LutonVan);
                                imgVehicle.SetOnClickListener(this);

                                // add into my parent view
                                _layoutVehicleImages.AddView(imgVehicle);
                                _markdamage.SetBackgroundResource(Resource.Drawable.LutonVan);
                                iCurrentDamageImageId = 201;
                            }
                            else if (rentRunningTrans.VehicleType == "Standard Van")
                            {
                                imgVehicle.Id = 301;
                                imgVehicle.SetBackgroundResource(Resource.Drawable.StandardVan);
                                imgVehicle.SetOnClickListener(this);
                                // add into my parent view
                                _layoutVehicleImages.AddView(imgVehicle);
                                _markdamage.SetBackgroundResource(Resource.Drawable.StandardVan);
                                iCurrentDamageImageId = 301;
                            }

                            _markdamage.RemoveAllViews();
                            _markdamage.SetOnTouchListener(this);
                            _markdamage.SetOnDragListener(this);

                            if (rentRunningTrans.RentVehicleDamage != null)
                            {
                                foreach (var objVehicleMarkDamage in rentRunningTrans.RentVehicleDamage.Where(x => x.DamageImageId == iCurrentDamageImageId).OrderBy(x => x.DamageNumber))
                                {
                                    this.DrawDamageCircle(objVehicleMarkDamage);
                                    iLastDamageNumber = objVehicleMarkDamage.DamageNumber;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            //Do nothing
                        }
                    }
                }
            }
            else
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetMessage("Please enable internet to get vehicle images from API.");
                alert.SetNeutralButton("OK", delegate { });
                alert.Create().Show();
            }
            //this.progressLayout.Visibility = ViewStates.Gone;
        }