コード例 #1
0
ファイル: TabView.cs プロジェクト: flashcsgroups/Home
        protected override void OnCreate(Android.OS.Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.TabView);

            var fragments = new List <MvxViewPagerFragmentAdapter.FragmentInfo>
            {
                new MvxViewPagerFragmentAdapter.FragmentInfo
                {
                    FragmentType = typeof(CitiesView),
                    Title        = "Fragment1",
                    ViewModel    = ViewModel.Cities
                },
                new MvxViewPagerFragmentAdapter.FragmentInfo
                {
                    FragmentType = typeof(BanksView),
                    Title        = "Fragment2",
                    ViewModel    = ViewModel.Banks
                }
            };

            _viewPager         = FindViewById <ViewPager>(Resource.Id.viewPager);
            _adapter           = new MvxViewPagerFragmentAdapter(this, SupportFragmentManager, fragments);
            _viewPager.Adapter = _adapter;

            //_pageIndicator = FindViewById<titlepageindicator>(Resource.Id.viewPagerIndicator);

            //_pageIndicator.SetViewPager(_viewPager);
            //_pageIndicator.CurrentItem = 0;
        }
コード例 #2
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "mainGPS" layout resource, reload MapView
            SetContentView(Resource.Layout.MainGPS);
            mapView = (MapView)FindViewById(Resource.Id.mapView);

            // Set online base layer
            var baseLayer = new NutiteqOnlineVectorTileLayer("nutibright-v2a.zip");

            mapView.Layers.Add(baseLayer);

            // bind the textViewMessage
            _textViewMessage = FindViewById <TextView> (Resource.Id.textViewMessage);

            // create layer and add object to the layer, finally add layer to the map.
            // All overlay layers must be same projection as base layer, so we reuse it
            _markerDataSource = new LocalVectorDataSource(mapView.Options.BaseProjection);
            var _markerLayer = new VectorLayer(_markerDataSource);

            mapView.Layers.Add(_markerLayer);

            // inizialize the location manager to get the current position
            InitializeLocationManager();
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: zvinch/SharpDungeon
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            BitmapCache.Context = TextureCache.Context = Instance = this;

            DisplayMetrics m = new DisplayMetrics();

            WindowManager.DefaultDisplay.GetMetrics(m);
            density = m.Density;

            try
            {
                version = PackageManager.GetPackageInfo(PackageName, 0).VersionName;
            }
            catch (PackageManager.NameNotFoundException)
            {
                version = "???";
            }

            VolumeControlStream = Stream.Music;

            view = new GLSurfaceView(this);
            view.SetEGLContextClientVersion(2);
            view.SetEGLConfigChooser(false);
            view.SetRenderer(this);
            view.SetOnTouchListener(this);
            SetContentView(view);
        }
コード例 #4
0
        public override Dialog OnCreateDialog(Android.OS.Bundle savedInstanceState)
        {
            LayoutInflater inflater = Activity.LayoutInflater;

            if (null != savedInstanceState)
            {
                _searchableItem = (ISearchableItem <SimpleSelectorItem>)savedInstanceState.GetSerializable("item");
            }
            // Change End

            View rootView = inflater.Inflate(Resource.Layout.SearchableDialog, null);

            SetData(rootView);

            AlertDialog.Builder alertDialog = new AlertDialog.Builder(Activity);
            alertDialog.SetView(rootView);

            string strPositiveButton = _strPositiveButtonText == null ? "CLOSE" : _strPositiveButtonText;

            alertDialog.SetPositiveButton(_strPositiveButtonText, (sender, e) => { });

            string strTitle = _strTitle == null ? "Select Item" : _strTitle;

            alertDialog.SetTitle(strTitle);

            AlertDialog dialog = alertDialog.Create();

            dialog.Window.SetSoftInputMode(SoftInput.StateHidden);
            return(dialog);
        }
コード例 #5
0
        public override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (savedInstanceState != null)
            {
                mSignInButtonClicked = savedInstanceState.GetBoolean(KEY_SIGNIN_BUTTON_CLICKED);
            }

            var args = Arguments;

            if (args != null)
            {
                mLoginAction = args.GetInt(LoginActivity.EXTRA_ACTION);
            }

            var options = new PlusClass.PlusOptions.Builder().Build();

            mGoogleApiClient = new GoogleApiClient.Builder(Activity)
                               .AddApi(PlusClass.API, options)
                               .AddConnectionCallbacks(this)
                               .AddOnConnectionFailedListener(this)
                               .AddScope(PlusClass.ScopePlusProfile)
                               .AddScope(new Scope(WALLET_SCOPE))
                               .Build();
        }
コード例 #6
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable {
                Color = Colors.ActionBar
            });

            Title = GetType().GetTitle();

            // Create package manager
            File packageFolder = new File(ApplicationContext.GetExternalFilesDir(null), "regionpackages");

            if (!(packageFolder.Mkdir() || packageFolder.IsDirectory))
            {
                this.MakeToast("Could not create package folder!");
            }

            try
            {
                packageManager = new CartoPackageManager("nutiteq.osm", packageFolder.AbsolutePath);
            }
            catch (IOException e)
            {
                this.MakeToast("Exception: " + e);
                Finish();
            }

            // Initialize ListView
            SetContentView(Resource.Layout.List);
            packageAdapter   = new PackageManagerAdapter(this, ListView, Resource.Layout.package_item_row, packageArray);
            ListView.Adapter = packageAdapter;
        }
コード例 #7
0
        public override void OnActivityCreated(Android.OS.Bundle savedInstanceState)
        {
            Dialog.Window.RequestFeature(Android.Views.WindowFeatures.NoTitle);             //Set title bar to invisible
            base.OnActivityCreated(savedInstanceState);
            Dialog.Window.Attributes.WindowAnimations = Resource.Style.dialog_anim;         //Set the animation

            var localContacts = Application.Context.GetSharedPreferences("MyContacts", FileCreationMode.Private);

            string usernameTag  = "Username";
            string latitudeTag  = "Latitude";
            string longitudeTag = "Longitude";
            string myContactTag = "myContact";

            List <Contact> contacts = new List <Contact>();

            for (int i = 0; i < 20; i++)
            {
                usernameTag  = usernameTag + i;
                latitudeTag  = latitudeTag + i;
                longitudeTag = longitudeTag + i;
                myContactTag = myContactTag + i;

                string username   = localContacts.GetString(usernameTag, " ");
                string slatitude  = localContacts.GetString(latitudeTag, " ");
                string slongitude = localContacts.GetString(longitudeTag, " ");

                double testvar;
                double latitude;
                double longitude;

                if (Double.TryParse(slatitude, out testvar))
                {
                    latitude = testvar;
                }
                else
                {
                    latitude = 0.0;
                }

                if (Double.TryParse(slongitude, out testvar))
                {
                    longitude = testvar;
                }
                else
                {
                    longitude = 0.0;
                }

                contacts.Add(new Contact(username, latitude, longitude));
            }

            //add list to list adapter
            ArrayAdapter adapter = new ArrayAdapter <Contact>(Application.Context, Android.Resource.Layout.SimpleListItem1, contacts);

            _viewContactsListview.Adapter = adapter;
        }
コード例 #8
0
        public override void OnSaveInstanceState(Android.OS.Bundle outState)
        {
            base.OnSaveInstanceState(outState);

            try
            {
                MapView?.OnSaveInstanceState(outState);
            }
            catch { }
        }
コード例 #9
0
        public override Dialog OnCreateDialog(Android.OS.Bundle savedInstanceState)
        {
            Cancelable = false;
            ProgressDialog _progressDialog = new ProgressDialog(Activity);

            _progressDialog.SetMessage("Getting location...");
            _progressDialog.Indeterminate = true;
            _progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
            return(_progressDialog);
        }
コード例 #10
0
 public override void OnCreate(Android.OS.Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     try
     {
         mCallBack = (ITimeChangedListener)TargetFragment;
     }
     catch (Java.Lang.ClassCastException) {
         throw new Java.Lang.ClassCastException("Calling fragment must implement ");
     }
 }
コード例 #11
0
        protected override void OnCreate(ao.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var key = Intent.GetStringExtra("item");

            content = NavigationHandler.GetItem(key);
            if (content != null && content.Content != null)
            {
                SetContentView(content.Content.GetContainerView());
            }
        }
コード例 #12
0
        protected override void OnCreate(Android.OS.Bundle bundle)
        {
            Forms.Init(this, bundle);
            // Leverage controls' StyleId attrib. to Xamarin.UITest
            Forms.ViewInitialized += (sender, e) => {
                if (!string.IsNullOrWhiteSpace(e.View.StyleId))
                {
                    e.NativeView.ContentDescription = e.View.StyleId;
                }
            };

            base.OnCreate(bundle);
        }
コード例 #13
0
ファイル: WeatherAdapter.cs プロジェクト: eatage/AppTest.bak
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            // TODO Auto-generated method stub  
            LayoutInflater mInflater = LayoutInflater.From(context);
            //产生一个View  
            View view = null;
            //根据type不同的数据类型构造不同的View,也可以根据1,2,3天数构造不同的样式  
            if (type[position] == 0)
            {
                //view = mInflater.inflate(R.layout.city_item, null);  
                view = mInflater.Inflate(Resource.Layout.city_item, null);
                //获取城市名称  
                string cityName = list[position]["data"];

                ImageView image = view.FindViewById<ImageView>(Resource.Id.weather_image);
                Button viewBtn = view.FindViewById<Button>(Resource.Id.btn_click);
                viewBtn.Text = "详细";
                viewBtn.Tag = viewBtn.Id.ToString() + "/" + position.ToString();
                view.SetTag(viewBtn.Id, position.ToString());
                viewBtn.Click += delegate
                {
                    Intent intent = new Intent(context, typeof(layout1));
                    Android.OS.Bundle bundle = new Android.OS.Bundle();
                    intent.PutExtra("LayoutName", position.ToString() + cityName);
                    intent.PutExtras(bundle);
                    ((Activity1)context).StartActivityForResult(intent, 10);
                    // ((Activity1)context).SetContentView(Resource.Layout.layout1);  
                    // SetContentView(Resource.Layout.Main);  
                };

                TextView city = view.FindViewById<TextView>(Resource.Id.city);
                //city.setText(cityName);  
                city.Text = cityName;
            }
            else
            {
                view = mInflater.Inflate(Resource.Layout.content_item, null);
                //获取数据  
                string content = list[position]["data"];
                //分离数据  
                string[] items = content.Split(',');

                TextView weather = view.FindViewById<TextView>(Resource.Id.content);
                weather.Text = items[0] + "天气: " + items[1] + ";温度:  " + items[2];
                TextView date = view.FindViewById<TextView>(Resource.Id.date);
                date.Text = items[3];

            }

            return view;
        }
コード例 #14
0
 public override void OnCreate(Android.OS.Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     Android.Util.Log.Info("SuperAwesomeCardFragment", string.Format("OnCreate called"));
     if (savedInstanceState != null)
     {
         _position             = savedInstanceState.GetInt("position", 0);
         _enableProgressButton = savedInstanceState.GetBoolean("enableProgressButton", false);
     }
     if (this.View != null)
     {
         Android.Util.Log.Info("SuperAwesomeCardFragment", string.Format(string.Format("View already present for position {0}", _position)));
     }
 }
コード例 #15
0
ファイル: MainActivity.cs プロジェクト: webhead540/Film_DB-V2
        //      int currentpos;


        //Color colBack = Color.FromArgb(54, 57, 63);
        //Color colFont = Color.FromArgb(224, 224, 224);
        protected override void OnCreate(pie.Bundle savedInstanceState)
        {
            fileName    = Path.Combine(pie.Environment.ExternalStorageDirectory.AbsolutePath, pie.Environment.DirectoryDocuments, "filme.csv");
            picturePath = Path.Combine(pie.Environment.ExternalStorageDirectory.AbsolutePath, pie.Environment.DirectoryPictures, "FilmDB");

            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            btnFilter                 = FindViewById <Button>(Resource.Id.btn_Filter);
            btnSuggest                = FindViewById <Button>(Resource.Id.btn_suggest);
            btnSearch                 = FindViewById <Button>(Resource.Id.btnSearch);
            cbxAnime                  = FindViewById <CheckBox>(Resource.Id.cbxAnime);
            cbxMovie                  = FindViewById <CheckBox>(Resource.Id.cbxMovie);
            cbxSeries                 = FindViewById <CheckBox>(Resource.Id.cbxSeries);
            cbxWischlist              = FindViewById <CheckBox>(Resource.Id.cbxWishlist);
            grvContent                = FindViewById <GridView>(Resource.Id.grvContent);
            mainLayout                = FindViewById <CoordinatorLayout>(Resource.Id.mainLayout);
            tbxSearch                 = FindViewById <EditText>(Resource.Id.tbxSearch);
            grvContent.ItemLongClick += itemLongClick;
            grvContent.ItemClick     += itemClick;
            //fab.Click += FabOnClick;
            btnFilter.Click    += btnFilter_Click;
            btnSearch.Click    += btnSearch_Click;
            btnSuggest.Click   += btnSuggest_Click;
            cbxAnime.Click     += cbxClicked;
            cbxMovie.Click     += cbxClicked;
            cbxSeries.Click    += cbxClicked;
            cbxWischlist.Click += cbxClicked;
            fab.Visibility      = ViewStates.Invisible;
            try
            {
                mt = new mediaTools(fileName, picturePath, "");
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "beim Einlesen der CSV trat ein Fehler auf:" + Environment.NewLine + ex.Message, ToastLength.Short).Show();
            }

            tmrClickDelay.Enabled  = true;
            tmrClickDelay.Elapsed += OnTimedEvent;
            //randomList = mt.getRandomList();
            fillGui(true);

            /*ViewGroup.LayoutParams layoutParams = (ViewGroup.LayoutParams)grvContent.LayoutParameters;
             * layoutParams.Height = this.Resources.DisplayMetrics.HeightPixels - 130;
             * layoutParams.Width = this.Resources.DisplayMetrics.WidthPixels;
             * grvContent.LayoutParameters = layoutParams;*/
        }
コード例 #16
0
        protected override void OnCreate(Android.OS.Bundle bundle)
        {
            base.OnCreate(bundle);

            var statusBarColor = new Color(ContextCompat.GetColor(this, Resource.Color.onboardingStatusBarColor));

            this.ChangeStatusBarColor(statusBarColor);

            #if USE_ANALYTICS
            Microsoft.AppCenter.AppCenter.Start(
                "{TOGGL_APP_CENTER_ID_DROID}",
                typeof(Microsoft.AppCenter.Crashes.Crashes),
                typeof(Microsoft.AppCenter.Analytics.Analytics));
            #endif
        }
コード例 #17
0
ファイル: SignUp.cs プロジェクト: dragos98gl/SafeTraveling
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            RequestWindowFeature(Android.Views.WindowFeatures.NoTitle);
            Window.SetFlags(Android.Views.WindowManagerFlags.Fullscreen, Android.Views.WindowManagerFlags.Fullscreen);

            Bundle Extras = Intent.Extras;
            int    BackgroundByteArray = Extras.GetInt("BackgroundSignUpByteArray");

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.SignUp);

            Pager      = FindViewById <ViewPager> (Resource.Id.viewPager1);
            Titlu      = FindViewById <TextView> (Resource.Id.textView1);
            Background = FindViewById <RelativeLayout> (Resource.Id.relativeLayout1);

            string[] Titluri = new string[] {
                "Informatii Personale",
                "Informatii Virtuale",
                "Finalizare",
            };

            int[] Layouturi = new int[] {
                Resource.Layout.SignUp_Page1,
                Resource.Layout.SIgnUp_Page2,
                Resource.Layout.SignUp_Page3,
            };

            SetTypeface.Bold.SetTypeFace(this, Titlu);

            List <Drawable> DrawableList = new List <Drawable>();

            for (int i = 1; i < 5; i++)
            {
                DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LB/img" + i.ToString() + ".jpg", this));
            }
            for (int i = 1; i < 8; i++)
            {
                DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LoadingBackgrounds/img" + i.ToString() + ".jpg", this));
            }
            Background.Background = DrawableList[BackgroundByteArray];

            Pager.Adapter            = new ViewPagerAdapter(SupportFragmentManager, Layouturi, this, Pager);
            Pager.OffscreenPageLimit = 3;
            Pager.PageSelected      += (object sender, ViewPager.PageSelectedEventArgs e) => {
                Titlu.Text = Titluri[e.Position];
            };
        }
コード例 #18
0
 protected override void OnCreate(Android.OS.Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.main_view);
     if (bundle == null)
     {
         if (!ViewModel.IsUserLogin())
         {
             ViewModel.ShowGoogleLoginViewModelCommand.Execute(null);
         }
         else
         {
             ViewModel.ShowHomeViewModelCommand.Execute(null);
         }
     }
 }
コード例 #19
0
        public override void OnTokenError(Exception exception, Bundle bundle)
        {
            string MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Log.Info(MethodName, exception.Message);
            Intent intent = new Intent();

            intent.SetAction(HMSPushAction);
            intent.PutExtra(HMSPushReceiver.Method, System.Reflection.MethodBase.GetCurrentMethod().Name);
            Android.OS.Bundle bundleException = new Android.OS.Bundle();
            bundleException.PutString(HMSPushReceiver.Message, exception.Message);
            bundleException.PutInt(HMSPushReceiver.ErrorCode, ((BaseException)exception).ErrorCode);
            intent.PutExtra(HMSPushReceiver.Exception, bundleException);
            intent.PutExtra(HMSPushReceiver.Bundle, bundle);
            SendBroadcast(intent);
        }
コード例 #20
0
        public override void OnMessageDelivered(string msgId, Exception exception)
        {
            // Obtain the error code and description.
            string MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Log.Info(MethodName, $"msgId:{msgId}\nSituation:{exception.Message}");
            Intent intent = new Intent();

            intent.SetAction(HMSPushAction);
            intent.PutExtra(HMSPushReceiver.Method, System.Reflection.MethodBase.GetCurrentMethod().Name);
            intent.PutExtra(HMSPushReceiver.MsgId, msgId);
            Android.OS.Bundle bundle = new Android.OS.Bundle();
            bundle.PutString(HMSPushReceiver.Message, exception.Message);
            bundle.PutInt(HMSPushReceiver.ErrorCode, ((BaseException)exception).ErrorCode);
            intent.PutExtra(HMSPushReceiver.Exception, bundle);
            SendBroadcast(intent);
        }