public PhotoViewDroidAttacher(ImageView imageView)
        {
            mImageView = new Java.Lang.Ref.WeakReference(imageView);
            imageView.DrawingCacheEnabled = true;
            imageView.SetOnTouchListener (this);
            ViewTreeObserver observer = imageView.ViewTreeObserver;
            if (null != observer)
                observer.AddOnGlobalLayoutListener(this);

            // Make sure we using MATRIX Scale Type
            SetImageViewScaleTypeMatrix (imageView);

            if (imageView.IsInEditMode) {
                return;
            }

            // Create Gesture Detectors...
            mScaleDragDetector = VersionedGestureDetector.NewInstance(
                imageView.Context, this);
            mGestureDetector = new GestureDetector (imageView.Context, new MSimpleOnGestureListener (this));

            mGestureDetector.SetOnDoubleTapListener (new DefaultOnDoubleTapListener (this));

            SetZoomable (true);
        }
Пример #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			GetButton = FindViewById<Button> (Resource.Id.GetButton);
			ResultTextView = FindViewById<TextView> (Resource.Id.ResultTextView);
			ResultEditText = FindViewById<EditText> (Resource.Id.ResultEditText);
			DownloadedImageView = FindViewById<ImageView> (Resource.Id.DownloadedImageView);

			GetButton.Click += async (sender, e) => {
				
				Task<int> sizeTask = DownloadHomePageAsync();

				ResultTextView.Text = "Loading...";
				ResultEditText.Text = "Loading...\n";

				DownloadedImageView.SetImageResource ( Android.Resource.Drawable.IcMenuGallery);

				var length = await sizeTask;

				ResultTextView.Text = "length:  " + length;

			};

		}
Пример #3
0
		protected override void OnCreate (Bundle bundle)
		{
			dice1 = new Dice(1, 1, 6);
			dice2 = new Dice(2, 1, 6);
			audio = new PlayAudio (this);
		
			base.OnCreate (bundle);

			game = LbManager.GetGame(Intent.GetIntExtra ("Battle", -1), Intent.GetIntExtra("Scenario", -1));

			// set our layout to be the home screen
			SetContentView(Resource.Layout.General);		

			imgBack = FindViewById<ImageView> (Resource.Id.titleSubLbBack);
			imgLb = FindViewById<ImageView> (Resource.Id.titleSubLb);

			// title
			txtBattleName = FindViewById<TextView>(Resource.Id.titleSubBattleName);
			txtScenarioName = FindViewById<TextView>(Resource.Id.titleSubScenarioName);
			
			imgGeneral2Die1 = FindViewById<ImageView> (Resource.Id.imgGeneral2Die1);
			imgGeneral2Die2 = FindViewById<ImageView> (Resource.Id.imgGeneral2Die2);
			btnGeneral2DiceRoll = FindViewById<Button>(Resource.Id.btnGeneral2DiceRoll);

			imgGeneral1Die1 = FindViewById<ImageView> (Resource.Id.imgGeneral1Die1);
			btnGeneral1DiceRoll = FindViewById<Button>(Resource.Id.btnGeneral1DiceRoll);
		}
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			if (container == null) {
				// Currently in a layout without a container, so no reason to create our view.
				return null;
			}

			var view = inflater.Inflate(Resource.Layout.animal_screen, container, false);

			var animal = EvolveData.AnimalData [ShownAnimalIndex];

			headshotImageView = view.FindViewById<ImageView> (Resource.Id.headshotImageView);
			//var headshot = GetHeadShot (animal.HeadshotUrl);
			//headshotImageView.SetImageDrawable (headshot);

			animalNameTextView = view.FindViewById<TextView> (Resource.Id.animalNameTextView);
			animalNameTextView.Text = animal.Name;

			speciesNameTextView = view.FindViewById<TextView> (Resource.Id.speciesNameTextView);
			speciesNameTextView.Text = animal.Species;

			twitterHandleView = view.FindViewById<TextView> (Resource.Id.twitterTextView);
			//twitterHandleView.Text = "@" + animal.TwitterHandle;

			return view;
		}
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			if (container == null) {
				// Currently in a layout without a container, so no reason to create our view.
				return null;
			}

			var view = inflater.Inflate(Resource.Layout.speaker_screen, container, false);

			var speaker = EvolveData.SpeakerData [ShownSpeakerIndex];

			headshotImageView = view.FindViewById<ImageView> (Resource.Id.headshotImageView);
			var headshot = GetHeadShot (speaker.HeadshotUrl);
			headshotImageView.SetImageDrawable (headshot);

			speakerNameTextView = view.FindViewById<TextView> (Resource.Id.speakerNameTextView);
			speakerNameTextView.Text = speaker.Name;

			companyNameTextView = view.FindViewById<TextView> (Resource.Id.companyNameTextView);
			companyNameTextView.Text = speaker.Company;

			twitterHandleView = view.FindViewById<TextView> (Resource.Id.twitterTextView);
			twitterHandleView.Text = "@" + speaker.TwitterHandle;

			return view;
		}
		public FileListRowViewHolder(TextView timeTextView, TextView textView, ImageView imageView, FloatingActionButton fab)
		{
			TimeTextView = timeTextView;
			TextView = textView;
			ImageView = imageView;
			Fab = fab;
		}
Пример #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                _task = Rep.DatabaseHelper.Tasks.Enumerator.Current;
                var category = Rep.DatabaseHelper.Tasks.GetCategory(_task.CategoryId);
                SetContentView(Resource.Layout.ImageCard);
                _image = FindViewById<ImageView>(Resource.Id.imageCardView);
                var imageIdentifier = this.Resources.GetIdentifier(category.Image, "drawable", this.PackageName);
                _image.SetImageResource(imageIdentifier);

                var text = FindViewById<TextView>(Resource.Id.textCard);
                text.SetTypeface(Rep.FontManager.Get(Font.BankirRetro), TypefaceStyle.Normal);
                text.Text = _task.TaskName;

                _contentFrameLayout = FindViewById(Resource.Id.contentFrameLayout);

                _contentFrameLayout.Click += ContentFrameLayoutOnClick;

            }
            catch (Exception exception)
            {
                GaService.TrackAppException(this.Class,"OnCreate", exception, false);
                base.OnBackPressed();
            }
        }
Пример #8
0
        void KeepMe()
        {
            var txt = new TextView(null);
            txt.Text = txt.Text;

            var iv = new ImageView(null);
            var obj = iv.Drawable;

            var prog = new ProgressBar(null);
            prog.Progress = prog.Progress;

            var cb = new RadioButton(null);
            cb.Checked = cb.Checked;

            var np = new NumberPicker(null);
            np.Value = np.Value;

            var rb = new RatingBar(null);
            rb.Rating = rb.Rating;

            var cv = new CalendarView(null);
            cv.Date = cv.Date;

            var th = new TabHost(null);
            th.CurrentTab = th.CurrentTab;

            var tp = new TimePicker(null);
            tp.CurrentHour = tp.CurrentHour;
            tp.CurrentMinute = tp.CurrentMinute;

            
        }
Пример #9
0
		//Metodo principal en el cual se creara el servicio y pintaremos nuestro imageview sobre la ventana
		public override void OnCreate ()
		{
			base.OnCreate ();
			//incializaremos en windowmanager obteniendo el servicio directo de la ventan del sistema y haremos
			//un casting de tipo JavaCast<IWindowManager>
			windowManager = GetSystemService ("window").JavaCast<IWindowManager> ();
			//inicializaremos nuestro imageview dandole los atributos de nuestra clase para que obtenga los metodos
			//de touch
			chatHead = new ImageView(this);
			//definimos la imagen del imageview
			chatHead.SetImageResource (Resource.Drawable.ic_launcher);
			//Asignamos el listener del touch nuestra clase del tipo View.IOnTouchListener
			chatHead.SetOnTouchListener (this);
			//instanciamos los parametros que necesitamos para poder tomar la pantalla y asi poder mostrar nuestro imageview
			param = new WindowManagerLayoutParams(
				WindowManagerLayoutParams.WrapContent,
				WindowManagerLayoutParams.WrapContent,
				WindowManagerTypes.Phone,
				WindowManagerFlags.NotFocusable,
				Format.Translucent);
			//Agregamos la propiedad de gravedad en la parte de arriba hacia la izquieda
			param.Gravity = GravityFlags.Top | GravityFlags.Left;
			//Asignamos la posicion X del imageview
			param.X = 0;
			//Asignamos la posicion Y del imageview
			param.Y = 100;
			//Agregamos una vista a la ventana del sistema con nuestro imageview y los parametros generados
			windowManager.AddView (chatHead, param);
		}
Пример #10
0
        public static void DecodeFloatElementLayout(Context context, View layout, out TextView label, out SeekBar slider,
                                                    out ImageView left, out ImageView right)
        {
            if (layout == null)
            {
                label = null;
                slider = null;
                left = null;
                right = null;
                return;
            }

            label =
                layout.FindViewById<TextView>(context.Resources.GetIdentifier("dialog_LabelField", "id",
                                                                              context.PackageName));
            slider =
                layout.FindViewById<SeekBar>(context.Resources.GetIdentifier("dialog_SliderField", "id",
                                                                             context.PackageName));
            left =
                layout.FindViewById<ImageView>(context.Resources.GetIdentifier("dialog_ImageLeft", "id",
                                                                               context.PackageName));
            right =
                layout.FindViewById<ImageView>(context.Resources.GetIdentifier("dialog_ImageRight", "id",
                                                                               context.PackageName));
        }
Пример #11
0
        public override View GetView(Context context, View convertView, ViewGroup parent)
		{
            this.Click = delegate { SelectImage(); };

            Bitmap scaledBitmap = Bitmap.CreateScaledBitmap(_image, dimx, dimy, true);

            var view = convertView as RelativeLayout;
            if (view == null)
            {
                view = new RelativeLayout(context);
                _imageView = new ImageView(context);
            }
            else
            {
                _imageView = (ImageView)view.GetChildAt(0);
            }
            _imageView.SetImageBitmap(scaledBitmap);
            
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 2, 5, 2);
            parms.AddRule( LayoutRules.AlignParentLeft);
			if(_imageView.Parent != null && _imageView.Parent is ViewGroup)
				((ViewGroup)_imageView.Parent).RemoveView(_imageView);
			view.AddView(_imageView, parms);

            return view;
		}
Пример #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.animations_main_screen);

            mPhotosList = (ListView)FindViewById (Android.Resource.Id.List);
            mImageView = (ImageView)FindViewById (Resource.Id.picture);
            mContainer = (ViewGroup)FindViewById (Resource.Id.container);

            // Prepare the ListView
            ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,
                Android.Resource.Layout.SimpleListItem1, PHOTOS_NAMES);

            mPhotosList.Adapter = adapter;
            mPhotosList.ItemClick += OnItemClick;

            // Prepare the ImageView
            mImageView.Clickable = true;
            mImageView.Focusable = true;
            mImageView.Click += OnClick;
            //mImageView.SetOnClickListener (this);

            // Since we are caching large views, we want to keep their cache
            // between each animation
            mContainer.PersistentDrawingCache = PersistentDrawingCaches.AnimationCache;
        }
Пример #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.NewsItem);
            var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar (toolbar);
            SupportActionBar.Title = "Nachrichten";
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetHomeButtonEnabled (true);
            _settings = new Settings (this);
            _thatThing = _settings.ReadNews ("lastClick");

            var type  = Typeface.CreateFromAsset (Assets, "SourceSansPro-Regular.ttf");
            var bold  = Typeface.CreateFromAsset (Assets, "SourceSansPro-Bold.ttf");

            Title = _thatThing.SourcePrint;

            _main = FindViewById<TextView> (Resource.Id.mainText);
            _title = FindViewById<TextView> (Resource.Id.title);
            _icon = FindViewById<ImageView> (Resource.Id.icon);
            _main.Text = _thatThing.Content;
            _main.Typeface = type;
            _title.Text = _thatThing.Title;
            _title.Typeface = bold;
            _icon.SetUrlDrawable (_thatThing.Image, Resource.Drawable.notifications);
        }
 //-----------clicking on images -> image on fullscreen---------//
 protected void ImageZoom(ImageView imageView, string Tag, LinearLayout fullScreen, LinearLayout downScreen, Button takeIt)
 {
     imageView.Click += ((object sender, System.EventArgs e) => {
         Log.Info(Tag, "isImageFitToScreen: " + isImageFitToScreen.ToString());
         if (isImageFitToScreen) {
             downScreen.RemoveView(imageView);
             imageView.SetMaxHeight (1500);
             imageView.SetMaxWidth (1500);
             fullScreen.AddView(imageView);
             fullScreen.AddView(takeIt);
             Log.Info(Tag, "maximize");
             canBeSelected = true;
             isImageFitToScreen = false;
         } else {
             fullScreen.RemoveView(takeIt);
             fullScreen.RemoveView(imageView);
             imageView.SetMaxHeight (450);
             imageView.SetMaxWidth (450);
             downScreen.AddView(imageView);
             Log.Info(Tag, "minimize");
             canBeSelected = false;
             isImageFitToScreen = true;
         }
     });
 }
Пример #15
0
		private static void SetUrlDrawable(Context context, ImageView imageView, string url, int defaultResource, long cacheDurationMs)
		{
			Drawable d = null;
			if (defaultResource != 0)
				d = imageView.Resources.GetDrawable(defaultResource);
			SetUrlDrawable(context, imageView, url, d, cacheDurationMs, null);
		}
		public MyVote_ChangeButton(Activity context, string imgId, ImageView imgView,int position)
		{
			this.context = context;
			imageID = imgId;
			imageView = imgView;
			this.position = position;
		}
		private void InitView()
		{
			//设置标题栏
			var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
			img_header_back.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
			tv_back.Text = "返回";
			var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
			tv_desc.Text = "银行卡信息";

			edit_cardOwnerName = FindViewById<EditText> (Resource.Id.edit_cardOwnerName);
			edit_IdCardNo = FindViewById<EditText> (Resource.Id.edit_IdCardNo);
			edit_bankopenloc = FindViewById<EditText> (Resource.Id.edit_bankopenloc);
			edit_bankbranch = FindViewById<EditText> (Resource.Id.edit_bankbranch);
			edit_bankCardNo = FindViewById<EditText> (Resource.Id.edit_bankCardNo);
			edit_prePhoneNo = FindViewById<EditText> (Resource.Id.edit_prePhoneNo);
			edit_Code = FindViewById<EditText> (Resource.Id.edit_Code);
			img_choosebank = FindViewById<ImageView> (Resource.Id.img_choosebank);

			tv_SendCodeStatusShow = FindViewById<TextView> (Resource.Id.tv_SendCodeStatusShow);

			cb_defaut_bank = FindViewById<CheckBox> (Resource.Id.cb_defaut_bank);
			btn_Send = FindViewById<Button> (Resource.Id.btn_Send);
			btn_Add = FindViewById<Button> (Resource.Id.btn_Add);

			//选择银行卡
			img_choosebank.Click += (sender, e) => 
			{
				var intent = new Intent(this,typeof(ChooseBankTypeActivity));
				var requestCode = 0;  
				StartActivityForResult(intent,requestCode);
			};
			//安全码验证
			edit_Code.TextChanged += (sender, e) => 
			{
				if(edit_Code.Text.Length>0)
					btn_Add.Enabled = true;
				else
					btn_Add.Enabled =false;
			};
			//初始化计时器,启动
			mc = new MyCount(this,60000,1000);
			//发送验证码
			btn_Send.Click += (sender, e) => 
			{
				tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
				btn_Send.Enabled = false;
				SendCode();
			};

			//添加银行卡信息
			btn_Add.Click += (sender, e) => 
			{
				AddBank();
			};
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.ExhibitorDetailsScreen);

            var id = Intent.GetIntExtra("UserGroupID", -1);

            if (id >= 0) {
                usergroup = BL.Managers.UserGroupManager.GetUserGroup(id);
                if (usergroup != null) {
                    FindViewById<TextView>(Resource.Id.NameTextView).Text = usergroup.Name;
                    //FindViewById<TextView>(Resource.Id.CountryTextView).Text = usergroup.FormattedCityCountry;
                    //FindViewById<TextView>(Resource.Id.LocationTextView).Text = usergroup.Locations;
                    if (!String.IsNullOrEmpty(usergroup.Overview))
                        FindViewById<TextView>(Resource.Id.DescriptionTextView).Text = usergroup.Overview;
                    else
                        FindViewById<TextView>(Resource.Id.DescriptionTextView).Text = "No background information available.";
                    // now do the image
                    imageview = FindViewById<ImageView>(Resource.Id.ExhibitorImageView);
                    var uri = new Uri(usergroup.ImageUrl);
                    Console.WriteLine("usergroup.ImageUrl " + usergroup.ImageUrl);
                    try {
                        var drawable = MonoTouch.Dialog.Utilities.ImageLoader.DefaultRequestImage(uri, this);
                        if (drawable != null)
                            imageview.SetImageDrawable(drawable);
                    } catch (Exception ex) {
                        Console.WriteLine(ex.ToString());
                    }
                } else {   // shouldn't happen...
                    FindViewById<TextView>(Resource.Id.NameTextView).Text = "UserGroup not found: " + id;
                }
            }
        }
		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			base.OnViewCreated (view, savedInstanceState);

			productImage = View.FindViewById<ImageView> (Resource.Id.productImage);
			
			sizeSpinner = View.FindViewById<Spinner> (Resource.Id.productSize);

			colorSpinner = View.FindViewById<Spinner> (Resource.Id.productColor);

			var addToBasket = View.FindViewById<Button> (Resource.Id.addToBasket);
			addToBasket.Click += delegate {
				currentProduct.Size = currentProduct.Sizes [sizeSpinner.SelectedItemPosition];
				currentProduct.Color = currentProduct.Colors [colorSpinner.SelectedItemPosition];
				shouldAnimatePop = true;
				Activity.FragmentManager.PopBackStack();
				AddToBasket (currentProduct);
			};

			View.FindViewById<TextView> (Resource.Id.productTitle).Text = currentProduct.Name ?? string.Empty;
			View.FindViewById<TextView> (Resource.Id.productPrice).Text = currentProduct.PriceDescription ?? string.Empty;
			View.FindViewById<TextView> (Resource.Id.productDescription).Text = currentProduct.Description ?? string.Empty;

			((SlidingLayout)View).InitialMainViewDelta = slidingDelta;

			LoadOptions ();
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.DisplayHominid);
            if (Intent == null)
            {
                return;
            }

            var intentType = Intent.Type ?? String.Empty;
            _imageView = FindViewById<ImageView>(Resource.Id.ape_view);

            var button = FindViewById<Button>(Resource.Id.back_to_main_activity);
            button.Click += (sender, args) => Finish();

            // MainActivity write the mimetype to the tag. We just do a quick check
            // to make sure that the tag that was discovered is indeed a tag that
            // this application wrote.
            if (MainActivity.ViewApeMimeType.Equals(intentType))
            {
                // Get the string that was written to the NFC tag, and display it.
                var rawMessages = Intent.GetParcelableArrayExtra(NfcAdapter.ExtraNdefMessages);
                var msg = (NdefMessage)rawMessages[0];
                var hominidRecord = msg.GetRecords()[0];
                var hominidName = Encoding.ASCII.GetString(hominidRecord.GetPayload());
                DisplayHominid(hominidName);
            }
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			base.OnCreateView (inflater, container, savedInstanceState);

			ctrl = ((GameController)this.Activity);

			if (container == null)
				return null;

			var view = inflater.Inflate(Resource.Layout.GameDetailScreen, container, false);

			_layoutDefault = view.FindViewById<ScrollView> (Resource.Id.scrollView);

			_imageView = view.FindViewById<ImageView> (Resource.Id.imageView);
			_imageDirection = view.FindViewById<ImageView> (Resource.Id.imageDirection);
			_textDescription = view.FindViewById<TextView> (Resource.Id.textDescription);
			_textDirection = view.FindViewById<TextView> (Resource.Id.textDirection);
			_layoutBottom = view.FindViewById<LinearLayout> (Resource.Id.layoutBottom);
			_layoutButtons = view.FindViewById<LinearLayout> (Resource.Id.layoutButtons);
			_layoutDirection = view.FindViewById<LinearLayout> (Resource.Id.layoutDirection);

			// Don't know a better way :(
			_layoutBottom.SetBackgroundResource(Main.BottomBackground);

			_layoutButtons.Visibility = ViewStates.Visible;

			HasOptionsMenu = !(activeObject is Task);

			return view;
		}
Пример #22
0
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.ActionBar);

            base.OnCreate(bundle);

            SetContentView(Resource.Layout.AssessmentActivity);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            recButton = FindViewById<Button>(Resource.Id.assessment_startBtn);
            recButton.Text = "Begin";
            recButton.Click += recButton_Click;
            recButton.Visibility = ViewStates.Gone;

            assessmentType = FindViewById<TextView>(Resource.Id.assessment_type);
            assessmentType.Text = "";

            localTempDirectory = AppData.Cache.Path + "/assessment";

            if (!Directory.Exists(localTempDirectory)) Directory.CreateDirectory(localTempDirectory);

            preambleContainer = FindViewById<LinearLayout>(Resource.Id.preamble_container);
            preambleContainer.Visibility = ViewStates.Gone;
            loadingContainer = FindViewById<LinearLayout>(Resource.Id.assessment_loading);
            loadingContainer.Visibility = ViewStates.Gone;
            fragmentContainer = FindViewById<FrameLayout>(Resource.Id.fragment_container);
            fragmentContainer.Visibility = ViewStates.Gone;

            helpButton = FindViewById<ImageView>(Resource.Id.assessment_info);
            helpButton.Click += helpButton_Click;
            helpButton.Visibility = ViewStates.Gone;

            LoadData(bundle);
        }
Пример #23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            if (IsThereAnAppToTakePictures())
            {
                CreateDirectoryForPictures();

                Button button = FindViewById<Button>(Resource.Id.myButton);
                _imageView = FindViewById<ImageView>(Resource.Id.imageView1);
                button.Click += TakeAPicture;
            }
            else
            {
                // No app for taking pictures exists on the phone :(
                MessageBox.Show("There is no camera app installed on this phone. Please install one.", "Error", this);
            }

            //// Get our button from the layout resource,
            //// and attach an event to it
            //Button button = FindViewById<Button>(Resource.Id.MyButton);

            //button.Click += delegate { button.Text = string.Format("{0} clicks!", count++) + Test.TEXT; };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //TODO: Step 9 - Add a Gesture Overlay View as the primary view
            // This activity will use a GestureOverlayView as it's content view. The layout file
            // will be added as a subview of this.
            GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
            SetContentView(gestureOverlayView);

            //TODO: Step 10 - Subscribe to gesture events
            gestureOverlayView.GesturePerformed += GestureOverlayViewOnGesturePerformed;

            //TODO: Step 11 - Load the gestures from the raw resource
            // Load the binary gesture file that we created.
            _gestureLibrary = GestureLibraries.FromRawResource(this, Resource.Raw.gestures);
            if (!_gestureLibrary.Load())
            {
				Log.Error(GetType().FullName, "There was a problem loading the gesture library.");
                Finish();
            }

            // Load up the layout file for this activity and add it as child view of the 
            // GestureOverlayView
            View view = LayoutInflater.Inflate(Resource.Layout.custom_gesture_layout, null);
            _imageView = view.FindViewById<ImageView>(Resource.Id.imageView1);
            gestureOverlayView.AddView(view);

            
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mRootView = inflater.Inflate(Resource.Layout.fragment_theme, container, false);

            mViewTheme = mRootView.FindViewById<BandThemeView>(Resource.Id.viewTheme);

            mButtonGetTheme = mRootView.FindViewById<Button>(Resource.Id.buttonGetTheme);
            mButtonGetTheme.Click += OnGetThemeClick;

            mButtonSetTheme = mRootView.FindViewById<Button>(Resource.Id.buttonSetTheme);
            mButtonSetTheme.Click += OnSetThemeClick;

            mButtonSelectBackground = mRootView.FindViewById<Button>(Resource.Id.buttonSelectBackground);
            mButtonSelectBackground.Click += OnSelectBackgroundClick;

            mImageBackground = mRootView.FindViewById<ImageView>(Resource.Id.imageBackground);

            mButtonGetBackground = mRootView.FindViewById<Button>(Resource.Id.buttonGetBackground);
            mButtonGetBackground.Click += OnGetBackgroundClick;

            mButtonSetBackground = mRootView.FindViewById<Button>(Resource.Id.buttonSetBackground);
            mButtonSetBackground.Click += OnSetBackgroundClick;

            return mRootView;
        }
Пример #26
0
        void Initialize ()
        {
            var inflater = (LayoutInflater)Context.GetSystemService (Context.LayoutInflaterService);
            inflater.Inflate (Resource.Layout.TogglField, this);

            // Workaround because the duplicated names
            // inside the component breaks the
            // databinding.
            var layout =  FindViewById<RelativeLayout> (Resource.Id.EditTimeEntryBit);
            for (int i = 0; i < layout.ChildCount; i++) {
                if (layout.GetChildAt (i) is EditText) {
                    TextField = (EditText)layout.GetChildAt (i);
                }
            }

            titleText= FindViewById<TextView> (Resource.Id.EditTimeEntryBitTitle);
            assistView = FindViewById<TextView> (Resource.Id.EditTimeEntryBitAssistView);
            arrow = FindViewById<ImageView> (Resource.Id.EditTimeEntryBitArrow);

            TextField.EditorAction += OnTextFieldEditorActionListener;
            TextField.FocusChange += (sender, e) => {
                titleText.Selected = TextField.HasFocus;
                Selected = TextField.HasFocus;
            };
        }
Пример #27
0
//		void loadBackdrop()
//		{
//			var imageView = FindViewById<ImageView> (Resource.Id.backdrop);
//			var random = Pictures.GetRandomBackground ();
//			imageView.SetImageResource (random);
//		}
//		public override bool OnCreateOptionsMenu (IMenu menu)
//		{
//			MenuInflater.Inflate (Resource.Menu.sample_actions, menu);
//			return true;
//		}

		private void setupImage(ImageView image, string url){

			Picasso.With (MyVote.Const.context)
				.Load (url)
				.Placeholder (Resource.Drawable.placeholder_poster)
				.Into(image);
		}
Пример #28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
			
			
			ImageView img = new ImageView(this);
			img.SetImageResource(Resource.Drawable.spadeicon);
			
            var root = new RootElement("Test Root Elem")
                           {
                               new Section("Test Header", "Test Footer")
                                   {
                                       new BooleanElement("Push my button", true),
                                       new BooleanElement("Push this too", false),
                                       new StringElement("Text label", "The Value"),
									   new BooleanElement("Push my button", true),
                                       new BooleanElement("Push this too", false),
                                   },
                               new Section("Part II")
                                   {
                                       new StringElement("This is the String Element", "The Value"),
                                       new CheckboxElement("Check this out", true),
                                       new ImageElement(img),
									   new HtmlElement("Go to Google.com","http://www.google.com")
                                   }
                           };

            var da = new DialogAdapter(this, root);

            var lv = new ListView(this) {Adapter = da};

            SetContentView(lv);
        }
Пример #29
0
        protected async override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.ScheduleLayout);

                schedules = new List<ScheduleModel>();
                lv = (ListView)FindViewById(Resource.Id.lvSchedule);
                connectivityPointer = FindViewById<ImageView>(Resource.Id.ivConnectionSchedule);
                setConnectivityStatus(OnOffService.Online);

                //Hier die Schedules des Benutzers abholen und in die Liste einfügen
                ooService = new OnOffService();
                userID = Intent.GetStringExtra("User");
                Guid userId = new Guid(userID);
                IEnumerable<ScheduleModel> temp = await ooService.GetAllSchedulesAsync(userId);
                schedules = temp.ToList<ScheduleModel>();

                //ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Resource.Layout.ScheduleView, Resource.Id.txtScheduleViewDescription, schedules);
                ScheduleListViewAdapter adapter = new ScheduleListViewAdapter(this, schedules);
                lv.Adapter = adapter;


                lv.ItemClick += lv_ItemClick;
            }
            catch(ArgumentNullException ex)
            {
                Console.WriteLine("Keine UserId übergeben: " + ex.StackTrace);
            }
            catch(System.Exception exc)
            {
                Console.WriteLine("Fehler beim Erstellen des ScheduleViews: " + exc.StackTrace);
            }
        }
		public MyVote_YesOrNoDialog(Activity context, string imgId, ImageView imgView,int position)
		{
			this.context = context;
			imageId = imgId;
			imageView = imgView;
			this.position = position;
		}
Пример #31
0
        void DismissWorker()
        {
            SetFadeoutTimer(null);
            SetProgressTimer(null);

            UIView.Animate(0.3, 0, UIViewAnimationOptions.CurveEaseIn | UIViewAnimationOptions.AllowUserInteraction,
                           delegate {
                HudView.Transform.Scale(0.8f, 0.8f);
                if (isClear)
                {
                    HudView.Alpha = 0f;
                }
                else
                {
                    Alpha = 0f;
                }
            }, delegate {
                if (Alpha == 0f || HudView.Alpha == 0f)
                {
                    InvokeOnMainThread(delegate {
                        Alpha         = 0f;
                        HudView.Alpha = 0f;

                        //Removing observers
                        UnRegisterNotifications();
                        NSNotificationCenter.DefaultCenter.RemoveObserver(this);

                        Ring.ResetStyle(IsiOS7ForLookAndFeel, (IsiOS7ForLookAndFeel ? TintColor : UIColor.White));

                        CancelRingLayerAnimation();
                        StringLabel.RemoveFromSuperview();
                        SpinnerView.RemoveFromSuperview();
                        ImageView.RemoveFromSuperview();
                        if (_cancelHud != null)
                        {
                            _cancelHud.RemoveFromSuperview();
                        }

                        StringLabel = null;
                        SpinnerView = null;
                        ImageView   = null;
                        _cancelHud  = null;

                        HudView.RemoveFromSuperview();
                        HudView = null;
                        OverlayView.RemoveFromSuperview();
                        OverlayView = null;
                        this.RemoveFromSuperview();

                        if (IsiOS7ForLookAndFeel)
                        {
                            var rootController = UIApplication.SharedApplication.KeyWindow.RootViewController;
                            if (rootController != null)
                            {
                                rootController.SetNeedsStatusBarAppearanceUpdate();
                            }
                        }
                    });
                }
            });
        }
Пример #32
0
 public static void UpdateIsAnimationPlaying(this ImageView imageView, IImageSourcePart image) =>
 imageView.Drawable.UpdateIsAnimationPlaying(image);
Пример #33
0
 public static void UpdateAspect(this ImageView imageView, IImage image)
 {
     imageView.SetScaleType(image.Aspect.ToScaleType());
 }
Пример #34
0
 public SliderCard(View itemView) : base(itemView)
 {
     imageView = (ImageView)itemView.FindViewById(Resource.Id.image);
 }
Пример #35
0
 public PhotoToLoad(String url, ImageView imageView)
 {
     Url       = url;
     ImageView = imageView;
 }
Пример #36
0
        public void QueueImage(string url, ImageView imageView)
        {
            var photoToUpload = new PhotoToLoad(url, imageView);

            ThreadPool.QueueUserWorkItem(state => LoadPhoto(photoToUpload));
        }
Пример #37
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            context = Application.Context;
            var view = convertView ?? activitys.LayoutInflater.Inflate(Resource.Layout._modelTheBestShipListViewml, parent, false);


            ImageView img  = view.FindViewById <ImageView>(Resource.Id.imglistviewmodelS);
            ImageView flag = view.FindViewById <ImageView>(Resource.Id.theBestFlagS);

            txtName         = view.FindViewById <TextView>(Resource.Id.textTheBestShipName);
            txtCaliberSize  = view.FindViewById <TextView>(Resource.Id.textTheBestShipCaliber);
            txtCaliberItem  = view.FindViewById <TextView>(Resource.Id.textTheBestShipCaliberItem);
            txtCaliberTNT   = view.FindViewById <TextView>(Resource.Id.textTheBestShipCaliberTNT);
            txtMaxSpeed     = view.FindViewById <TextView>(Resource.Id.textTheBestShipMaxSpeed);
            txtTorpedoItem  = view.FindViewById <TextView>(Resource.Id.textTheBestShipTorpedoItem);
            txtTorpedoTNT   = view.FindViewById <TextView>(Resource.Id.textTheBestShipTorpedoTNT);
            txtDisplacement = view.FindViewById <TextView>(Resource.Id.textTheBestShipDisplacement);


            theBestIco1 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco1);
            theBestIco2 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco2);
            theBestIco3 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco3);
            theBestIco4 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco4);
            theBestIco5 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco5);
            theBestIco6 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco6);
            theBestIco7 = view.FindViewById <ImageView>(Resource.Id.theBestShipIco7);

            img.SetImageResource(ships[position].Image);
            flag.SetImageResource(ships[position].FlagImageTheBest);
            txtName.Text        = ships[position].Name;
            txtCaliberItem.Text = ships[position].MainCaliberItem.ToString() + context.Resources.GetString(Resource.String.AbbrITEMS);
            txtTorpedoItem.Text = ships[position].TorpedoItem.ToString() + context.Resources.GetString(Resource.String.AbbrITEMS);

            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(context);
            ISharedPreferencesEditor editor = prefs.Edit();
            var switchchecked = prefs.GetBoolean("key_kmhtomph", false);

            if (switchchecked)
            {
                var maxSpeed        = ships[position].MaxSpeed * 0.621371192;
                var mainCaliberSize = ships[position].MainCaliberSize * 0.039370;
                var mainCaliberTNT  = ships[position].MainCaliberTNT * 2.204622621849;
                var torpedoTNT      = ships[position].TorpedoTNT * 2.204622621849;
                var displacement    = ships[position].Displacement * 1.10231131;
                maxSpeed        = System.Math.Round(maxSpeed, 0);
                mainCaliberSize = System.Math.Round(mainCaliberSize, 1);
                mainCaliberTNT  = System.Math.Round(mainCaliberTNT, 1);
                torpedoTNT      = System.Math.Round(torpedoTNT, 0);
                displacement    = System.Math.Round(displacement, 0);

                txtMaxSpeed.Text     = maxSpeed + context.Resources.GetString(Resource.String.AbbrMPH);
                txtCaliberSize.Text  = mainCaliberSize + context.Resources.GetString(Resource.String.AbbrINCH);
                txtCaliberTNT.Text   = mainCaliberTNT + context.Resources.GetString(Resource.String.AbbrLB);
                txtTorpedoTNT.Text   = torpedoTNT + context.Resources.GetString(Resource.String.AbbrLB);
                txtDisplacement.Text = displacement + context.Resources.GetString(Resource.String.AbbrST);
            }
            else
            {
                txtMaxSpeed.Text     = ships[position].MaxSpeed.ToString() + context.Resources.GetString(Resource.String.AbbrKM_H);
                txtCaliberSize.Text  = ships[position].MainCaliberSize.ToString() + context.Resources.GetString(Resource.String.AbbrMM);
                txtCaliberTNT.Text   = ships[position].MainCaliberTNT.ToString() + context.Resources.GetString(Resource.String.AbbrKG);
                txtTorpedoTNT.Text   = ships[position].TorpedoTNT.ToString() + context.Resources.GetString(Resource.String.AbbrKG);
                txtDisplacement.Text = ships[position].Displacement.ToString() + context.Resources.GetString(Resource.String.AbbrT);
            }


            if (TheBestShip.SelectedTask == 1)
            {
                txtCaliberSize.Alpha = 1;
                theBestIco1.Alpha    = 1;
            }
            if (TheBestShip.SelectedTask == 2)
            {
                txtCaliberItem.Alpha = 1;
                theBestIco2.Alpha    = 1;
            }
            if (TheBestShip.SelectedTask == 3)
            {
                txtCaliberTNT.Alpha = 1;
                theBestIco3.Alpha   = 1;
            }
            if (TheBestShip.SelectedTask == 4)
            {
                txtMaxSpeed.Alpha = 1;
                theBestIco4.Alpha = 1;
            }
            if (TheBestShip.SelectedTask == 5)
            {
                txtTorpedoItem.Alpha = 1;
                theBestIco5.Alpha    = 1;
            }
            if (TheBestShip.SelectedTask == 6)
            {
                txtTorpedoTNT.Alpha = 1;
                theBestIco6.Alpha   = 1;
            }
            if (TheBestShip.SelectedTask == 7)
            {
                txtDisplacement.Alpha = 1;
                theBestIco7.Alpha     = 1;
            }

            return(view);
        }
        public void OnClick(View v)
        {
            var avatarView = new AvatarView(this);

            avatarView.AvatarSize = AvatarSize.Medium;
            avatarView.Name       = Resources.GetString(Resource.String.persona_name_johnie_mcconnell);

            var thumbnailImageView             = new ImageView(this);
            var thumbnailBitmap                = BitmapFactory.DecodeResource(Resources, Resource.Drawable.thumbnail_example_32);
            var roundedCornerThumbnailDrawable = RoundedBitmapDrawableFactory.Create(Resources, thumbnailBitmap);

            roundedCornerThumbnailDrawable.CornerRadius = Resources.GetDimension(Resource.Dimension.uifabric_snackbar_background_corner_radius);
            thumbnailImageView.SetImageDrawable(roundedCornerThumbnailDrawable);

            switch (v.Id)
            {
            // Single line
            case Resource.Id.btn_snackbar_single_line:
                Snackbar.Make(root_view, GetString(Resource.String.snackbar_single_line), Snackbar.LengthShort, Snackbar.Style.Regular).Show();
                break;

            case Resource.Id.btn_snackbar_single_line_custom_view:
                var circularProgress = (Build.VERSION.SdkInt >= Build.VERSION_CODES.Lollipop) ?
                                       new ProgressBar(this, null, 0, Resource.Style.Widget_UIFabric_CircularProgress_Small)
                        : LayoutInflater.Inflate(Resource.Layout.view_snackbar_circular_progress, null, false) as ProgressBar;

                circularProgress.IndeterminateDrawable.SetColorFilter(
                    new Color(ContextCompat.GetColor(this, Resource.Color.snackbar_circular_progress_drawable)), PorterDuff.Mode.SrcIn);

                Snackbar.Make(root_view, GetString(Resource.String.snackbar_single_line), Snackbar.LengthLong, Snackbar.Style.Regular)
                .SetCustomView(circularProgress, Snackbar.CustomViewSize.Medium)
                .Show();
                break;

            case Resource.Id.btn_snackbar_single_line_action:
                Snackbar.Make(root_view, GetString(Resource.String.snackbar_single_line))
                .SetAction(GetString(Resource.String.snackbar_action), () => { }).Show();
                break;

            case Resource.Id.btn_snackbar_single_line_action_custom_view:
                Snackbar.Make(root_view, GetString(Resource.String.snackbar_single_line))
                .SetCustomView(avatarView, Snackbar.CustomViewSize.Medium)
                .SetAction(GetString(Resource.String.snackbar_action), () => { })
                .Show();
                break;

            // Multiline
            case Resource.Id.btn_snackbar_multiline:
                Snackbar.Make(root_view, GetString(Resource.String.snackbar_multiline), Snackbar.LengthLong).Show();
                break;

            case Resource.Id.btn_snackbar_multiline_custom_view:
                var doneIconImageView = new ImageView(this);
                doneIconImageView.SetImageDrawable(ContextCompat.GetDrawable(this, Resource.Drawable.ic_done_white));

                Snackbar.Make(root_view, GetString(Resource.String.snackbar_multiline), Snackbar.LengthLong)
                .SetCustomView(doneIconImageView, Snackbar.CustomViewSize.Small)
                .Show();
                break;

            case Resource.Id.btn_snackbar_multiline_action:
                var snackbar = Snackbar.Make(root_view, GetString(Resource.String.snackbar_multiline), Snackbar.LengthIndefinite)
                               .SetAction(GetString(Resource.String.snackbar_action), () => { });
                snackbar.Show();

                System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(2))
                .ContinueWith(t =>
                {
                    snackbar.View.Post(() => snackbar.SetText(GetString(Resource.String.snackbar_description_updated)));
                });
                break;

            case Resource.Id.btn_snackbar_multiline_action_custom_view:
                Snackbar.Make(root_view, GetString(Resource.String.snackbar_multiline))
                .SetCustomView(thumbnailImageView, Snackbar.CustomViewSize.Medium)
                .SetAction(GetString(Resource.String.snackbar_action), () => {
                    // handle click here
                }).Show();
                break;

            case Resource.Id.btn_snackbar_multiline_long_action:
                Snackbar.Make(root_view, GetString(Resource.String.snackbar_multiline))
                .SetAction(GetString(Resource.String.snackbar_action_long), () => {
                    // handle click here
                }).Show();
                break;

            // Announcement style
            case Resource.Id.btn_snackbar_announcement:
                var announcementIconImageView = new ImageView(this);
                announcementIconImageView.SetImageDrawable(ContextCompat.GetDrawable(this, Resource.Drawable.ic_birthday));

                Snackbar.Make(root_view, GetString(Resource.String.snackbar_announcement), Snackbar.LengthShort, Snackbar.Style.Announcement)
                .SetCustomView(announcementIconImageView, Snackbar.CustomViewSize.Medium)
                .SetAction(GetString(Resource.String.snackbar_action), () =>
                {
                    // handle click here
                }).Show();
                break;
            }
        }
Пример #39
0
        public LoginView(LauncherWindow window)
        {
            Window        = window;
            this.MinWidth = 250;

            ErrorLabel = new Label("Username or password incorrect")
            {
                TextColor     = Color.FromBytes(255, 0, 0),
                TextAlignment = Alignment.Center,
                Visible       = false
            };
            UsernameText      = new TextEntry();
            PasswordText      = new PasswordEntry();
            LogInButton       = new Button("Log In");
            RegisterButton    = new Button("Register");
            OfflineButton     = new Button("Play Offline");
            RememberCheckBox  = new CheckBox("Remember Me");
            UsernameText.Text = UserSettings.Local.Username;
            if (UserSettings.Local.AutoLogin)
            {
                PasswordText.Password   = UserSettings.Local.Password;
                RememberCheckBox.Active = true;
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft_logo.png"))
                TrueCraftLogoImage = new ImageView(Image.FromStream(stream).WithBoxSize(350, 75));

            UsernameText.PlaceholderText = "Username";
            PasswordText.PlaceholderText = "Password";
            PasswordText.KeyReleased    += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                {
                    LogInButton_Clicked(sender, e);
                }
            };
            UsernameText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                {
                    LogInButton_Clicked(sender, e);
                }
            };
            RegisterButton.Clicked += (sender, e) =>
            {
                Window.WebView.Url = "https://truecraft.io/register";
            };
            OfflineButton.Clicked += (sender, e) =>
            {
                Window.User.Username  = UsernameText.Text;
                Window.User.SessionId = "-";
                Window.InteractionBox.Remove(this);
                Window.InteractionBox.PackEnd(Window.MainMenuView = new MainMenuView(Window));
            };
            var regoffbox = new HBox();

            RegisterButton.WidthRequest = OfflineButton.WidthRequest = 0.5;
            regoffbox.PackStart(RegisterButton, true);
            regoffbox.PackStart(OfflineButton, true);
            LogInButton.Clicked += LogInButton_Clicked;

            this.PackEnd(regoffbox);
            this.PackEnd(LogInButton);
            this.PackEnd(RememberCheckBox);
            this.PackEnd(PasswordText);
            this.PackEnd(UsernameText);
            this.PackEnd(ErrorLabel);
        }
        public RoundKnobButton(Context context, int back, Bitmap bmpRotorOn, Bitmap bmpRotorOff, int w, int h)
            : base(context)
        {
            Console.WriteLine("RoundKnobButton :: ctor :: Start");

            // We won't wait for our size to be calculated, we'll just store our fixed size
            m_Width  = w;
            m_Height = h;

            m_BmpRotorOn  = bmpRotorOn;
            m_BmpRotorOff = bmpRotorOff;

            //
            // Create stator
            //
            ImageView ivBack = new ImageView(context);

            ivBack.SetImageResource(back);
            RelativeLayout.LayoutParams lp_ivBack = new RelativeLayout.LayoutParams(w, h);
            lp_ivBack.AddRule(LayoutRules.CenterInParent);
            AddView(ivBack, lp_ivBack);

            //
            // Create Rotor
            //

            m_RotorImaveView = new ImageView(context);
            m_RotorImaveView.SetImageBitmap(bmpRotorOff);

            RelativeLayout.LayoutParams lp_ivKnob = new RelativeLayout.LayoutParams(w, h);            //LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            lp_ivKnob.AddRule(LayoutRules.CenterInParent);
            AddView(m_RotorImaveView, lp_ivKnob);

            SetState(true);

            //
            // Create Current Value Text
            //
            m_CurrentValueTextView = new TextView(context);
            m_CurrentValueTextView.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);
            m_CurrentValueTextView.Gravity = GravityFlags.Center;
            RelativeLayout.LayoutParams lp_cvKnob = new RelativeLayout.LayoutParams(LayoutParams.WrapContent, h / 2);
            lp_cvKnob.AddRule(LayoutRules.CenterInParent);
            AddView(m_CurrentValueTextView, lp_cvKnob);

            // Border for TextView
            GradientDrawable gd = new GradientDrawable();

            gd.SetColor(20);             // Changes this drawbale to use a single color instead of a gradient
            gd.SetCornerRadius(5);
            gd.SetStroke(1, Color.LightGray);
            // m_CurrentValueTextView.Background = gd;

            //
            // Circles
            //
            m_InnerCircle            = new CircleView(context, w, h, w / 8);
            m_InnerCircle.Visibility = (m_ShowTouchPath) ? ViewStates.Visible : ViewStates.Invisible;
            RelativeLayout.LayoutParams lp_circle = new RelativeLayout.LayoutParams(w, h);
            lp_circle.AddRule(LayoutRules.CenterInParent);
            AddView(m_InnerCircle, lp_circle);

            m_OuterCircle            = new CircleView(context, w, h, w / 3);
            m_OuterCircle.Visibility = (m_ShowTouchPath) ? ViewStates.Visible : ViewStates.Invisible;
            RelativeLayout.LayoutParams lp_circle2 = new RelativeLayout.LayoutParams(w, h);
            lp_circle2.AddRule(LayoutRules.CenterInParent);
            AddView(m_OuterCircle, lp_circle2);

            // Enable Gesture Detector
            gestureDetector = new GestureDetector(Context, this);
        }
Пример #41
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            /*ViewHolder holder;
             * if (convertView == null)
             * {
             *      LayoutInflater inflater = (LayoutInflater) mContext.GetSystemService(Context.LayoutInflaterService);
             *      convertView = inflater.Inflate(Resource.Layout.preview_pager_item_layout, parent, false);
             *      holder = new ViewHolder(convertView);
             *      convertView.SetTag(1, holder);
             * }
             * else
             * {
             *      holder = (ViewHolder) convertView.Tag;
             * }
             *
             * LayoutInflater inflater = (LayoutInflater) mContext.GetSystemService(Context.LayoutInflaterService);
             * convertView = inflater.Inflate(Resource.Layout.preview_pager_item_layout, parent, false);
             * holder = new ViewHolder(convertView);
             *
             * if (mPreviewSize != null)
             * {
             *      holder.PreviewPageImageView.LayoutParameters = new LinearLayout.LayoutParams(mPreviewSize.X, mPreviewSize.Y);
             * }
             *
             * holder.PreviewPageNumber.SetText((position + 1).ToString(), TextView.BufferType.Normal);
             * holder.PreviewPageLinearLayout.SetBackgroundColor(Color.Transparent);
             * DrawPageImageView(holder, position);
             * return convertView;*/

            int index = -1;

            if (mPages != null)
            {
                index = mPages[position];
            }
            else
            {
                index = position;
            }

            LayoutInflater inflater = (LayoutInflater)mContext.GetSystemService(Context.LayoutInflaterService);

            convertView = inflater.Inflate(Resource.Layout.PagesThumbItem, parent, false);

            TextView txtLabel = convertView.FindViewById <TextView>(Resource.Id.txtLabel);

            txtLabel.Text = string.Format(mContext.GetString(Resource.String.pub_pagina), (index + 1));

            ImageView imgThumb = convertView.FindViewById <ImageView>(Resource.Id.imgThumb);

            mPdfPreview.DrawPageImageView(imgThumb, index);

            //se è la pagina corrente setto il testo in grassetto
            if (mCurrentIndex != -1 && index == mCurrentIndex)
            {
                txtLabel.SetTypeface(txtLabel.Typeface, TypefaceStyle.Bold);
                txtLabel.TextSize = 20;
            }

            return(convertView);
        }
Пример #42
0
        private void SetFileRef(string fileName)
        {
            Text = fileName;
            Control ctl = null;

            fImageCtl = null;

            GDMMultimediaFormat fmt = GDMFileReference.RecognizeFormat(fileName);

            try {
                switch (fmt)
                {
                case GDMMultimediaFormat.mfBMP:
                case GDMMultimediaFormat.mfGIF:
                case GDMMultimediaFormat.mfJPG:
                case GDMMultimediaFormat.mfPCX:
                case GDMMultimediaFormat.mfTIF:
                case GDMMultimediaFormat.mfTGA:
                case GDMMultimediaFormat.mfPNG:
                {
                    fImageCtl = new ImageView();

                    try {
                        using (Stream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
                            fImageCtl.OpenImage(new Bitmap(fs));
                        }
                    } catch (Exception ex) {
                        Logger.WriteError("ImageViewerWin.SetFileRef.0()", ex);
                    }

                    ctl = fImageCtl;
                }
                break;

                case GDMMultimediaFormat.mfWAV:
                case GDMMultimediaFormat.mfAVI:
                case GDMMultimediaFormat.mfMPG:
                    break;

                case GDMMultimediaFormat.mfTXT:
                {
                    TextBox txtBox = new TextBox();
                    txtBox.Multiline  = true;
                    txtBox.ReadOnly   = true;
                    txtBox.ScrollBars = ScrollBars.Both;

                    try {
                        using (Stream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
                            using (StreamReader strd = GKUtils.GetDetectedStreamReader(fs)) {
                                txtBox.Text = strd.ReadToEnd();
                            }
                        }
                    } catch (Exception ex) {
                        Logger.WriteError("ImageViewerWin.SetFileRef.1()", ex);
                    }

                    ctl = txtBox;
                }
                break;

                case GDMMultimediaFormat.mfRTF:
                {
                    RichTextBox rtfBox = new RichTextBox();
                    rtfBox.ReadOnly = true;

                    try {
                        using (Stream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
                            using (StreamReader strd = new StreamReader(fs)) {
                                rtfBox.Text = strd.ReadToEnd();
                            }
                        }
                    } catch (Exception ex) {
                        Logger.WriteError("ImageViewerWin.SetFileRef.2()", ex);
                    }

                    ctl = rtfBox;
                }
                break;

                case GDMMultimediaFormat.mfHTM:
                {
                    var browser = new WebBrowser();
                    try {
                        using (Stream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
                            browser.DocumentStream = fs;
                        }
                    } catch (Exception ex) {
                        Logger.WriteError("ImageViewerWin.SetFileRef.2()", ex);
                    }
                    ctl = browser;
                }
                break;
                }

                if (ctl != null)
                {
                    SuspendLayout();

                    ctl.Dock     = DockStyle.Fill;
                    ctl.Location = new Point(0, 50);
                    ctl.Size     = new Size(100, 100);
                    Controls.Add(ctl);
                    Controls.SetChildIndex(ctl, 0);

                    ResumeLayout(false);
                    PerformLayout();
                }
            } catch (Exception ex) {
                if (ctl != null)
                {
                    ctl.Dispose();
                }

                Logger.WriteError("ImageViewerWin.SetFileRef()", ex);
            }
        }
Пример #43
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            //Step 1--Set our view from the "main" layout resource
            ActionBar.Hide();
            SetContentView(Resource.Layout.Profile);
            currentUser = JsonConvert.DeserializeObject <LoginTable>(Intent.GetStringExtra("CurrentUser"));

            //Step 3--Find Controls
            IVlogo = FindViewById <ImageView>(Resource.Id.IVlogo);
            IVlogo.SetImageResource(Resource.Drawable.logo);

            btnProfile = FindViewById <ImageButton>(Resource.Id.btnProfile);
            btnProfile.SetImageResource(Resource.Drawable.ic_action_person);

            btnAdd = FindViewById <ImageButton>(Resource.Id.btnAdd);
            btnAdd.SetImageResource(Resource.Drawable.ic_action_add_box);

            btnHome = FindViewById <ImageButton>(Resource.Id.btnHome);
            btnHome.SetImageResource(Resource.Drawable.ic_action_home);

            btnSearch = FindViewById <ImageButton>(Resource.Id.btnSearch);
            btnSearch.SetImageResource(Resource.Drawable.ic_action_search);

            btnLogout = FindViewById <ImageButton>(Resource.Id.btnLogout);
            btnLogout.SetImageResource(Resource.Drawable.ic_action_exit_to_app);

            txtUsernameInput = FindViewById <TextView>(Resource.Id.txtUsernameInput);
            txtEmailInput    = FindViewById <TextView>(Resource.Id.txtEmailInput);
            txtDateInput     = FindViewById <TextView>(Resource.Id.txtDateInput);
            txtRecNumInput   = FindViewById <TextView>(Resource.Id.txtRecNumInput);
            txtFollowNum     = FindViewById <TextView>(Resource.Id.txtFollowNum);
            txtFollowerNum   = FindViewById <TextView>(Resource.Id.txtFollowerNum);
            btnFollowers     = FindViewById <Button>(Resource.Id.btnFollowers);
            btnFollowing     = FindViewById <Button>(Resource.Id.btnFollowing);
            btnChangePW      = FindViewById <Button>(Resource.Id.btnChangePW);
            txtEmpty         = FindViewById <TextView>(Resource.Id.txtEmpty);
            lvToDo           = FindViewById <ListView>(Resource.Id.lvToDo);

            txtUsernameInput.Text = currentUser.username;
            txtEmailInput.Text    = currentUser.email;
            txtDateInput.Text     = currentUser.membersince.ToShortDateString();


            string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3"); //Call Database
            var    db     = new SQLiteConnection(dpPath);

            //-----------------Calculate Followers----------------------
            currentUser.followers = (from x in db.Table <Friendship>()
                                     where (x.friendFrom).Contains(currentUser.username)
                                     select x).ToList <Friendship>();

            currentUser.noOfFollowers = currentUser.followers.Count;

            txtFollowNum.Text += currentUser.noOfFollowers.ToString();

            //----------------Calculate Following--------------------------
            currentUser.following = (from x in db.Table <Friendship>()
                                     where (x.friendTo).Contains(currentUser.username)
                                     select x).ToList <Friendship>();

            currentUser.noOfFollowing = currentUser.following.Count;

            txtFollowerNum.Text += currentUser.noOfFollowing.ToString();

            //----------------Calculate RecomNum--------------------
            var data = db.Table <Recommendation>(); //Call Table

            recomNum = 0;
            foreach (var item in data)
            {
                if (item.recAuthor.Equals(currentUser.username))
                {
                    recomNum++;
                }
            }
            txtRecNumInput.Text = recomNum.ToString();

            //  txtRecNumInput.Text = currentUser.getRecommendationNum().ToString();

            if (currentUser.GetToDo().Count == 0)
            {
                txtEmpty.Text = "No items in To Do List";
            }
            else
            {
                RecommendationAdapter adapter = new RecommendationAdapter(this, Resource.Layout.ListView_Recommendation, currentUser.GetToDo());
                lvToDo.Adapter = adapter;
            }

            //Step 4--Event Handler(s)
            btnSearch.Click  += BtnSearch_Click;
            btnAdd.Click     += BtnAdd_Click;
            btnHome.Click    += BtnHome_Click;
            btnLogout.Click  += BtnLogout_Click;
            btnProfile.Click += BtnProfile_Click;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.AdsPayment);

            texthead = FindViewById <TextView>(Resource.Id.imgTextContribute);
            tf       = Typeface.CreateFromAsset(Assets, "Quicksand-Bold.otf");
            texthead.SetTypeface(tf, TypefaceStyle.Bold);

            texteasy = FindViewById <TextView>(Resource.Id.TextEasyPaisa);
            tf       = Typeface.CreateFromAsset(Assets, "Quicksand-Bold.otf");
            texteasy.SetTypeface(tf, TypefaceStyle.Bold);

            textjazz = FindViewById <TextView>(Resource.Id.TextJazzCash);
            tf       = Typeface.CreateFromAsset(Assets, "Quicksand-Bold.otf");
            textjazz.SetTypeface(tf, TypefaceStyle.Bold);

            textbank = FindViewById <TextView>(Resource.Id.TextBank);
            tf       = Typeface.CreateFromAsset(Assets, "Quicksand-Bold.otf");
            textbank.SetTypeface(tf, TypefaceStyle.Bold);

            textcard = FindViewById <TextView>(Resource.Id.TextCard);
            tf       = Typeface.CreateFromAsset(Assets, "Quicksand-Bold.otf");
            textcard.SetTypeface(tf, TypefaceStyle.Bold);

            easypaisa        = FindViewById <ImageView>(Resource.Id.imgEasyPaisa);
            easypaisa.Click += Easypaisa_Click;

            submit        = FindViewById <Button>(Resource.Id.button1);
            submit.Click += Submit_Click;

            jazzcash        = FindViewById <ImageView>(Resource.Id.imgJazzCash);
            jazzcash.Click += Jazzcash_Click;

            bankaccount        = FindViewById <ImageView>(Resource.Id.imgBankTransfer);
            bankaccount.Click += Bankaccount_Click;

            creditcard        = FindViewById <ImageView>(Resource.Id.CreditCard);
            creditcard.Click += Creditcard_Click;

            back        = FindViewById <ImageView>(Resource.Id.imggoback);
            back.Click += Back_Click;

            close        = FindViewById <ImageView>(Resource.Id.close);
            close.Click += Close_Click;

            radiobank        = FindViewById <RadioButton>(Resource.Id.Radiobank);
            radiobank.Click += Radiobank_Click;

            radiocard        = FindViewById <RadioButton>(Resource.Id.Radiocard);
            radiocard.Click += Radiocard_Click;

            radioeasy        = FindViewById <RadioButton>(Resource.Id.RadioEasypaisa);
            radioeasy.Click += Radioeasy_Click;

            radiojazz        = FindViewById <RadioButton>(Resource.Id.RadioJazzcash);
            radiojazz.Click += Radiojazz_Click;

            Task.Run(async() =>
            {
                paymentInfo = await new Model.PaymentInfo().getInfoFromDB();
            });
        }
        void ReleaseDesignerOutlets()
        {
            if (BtnChangeCertificate != null)
            {
                BtnChangeCertificate.Dispose();
                BtnChangeCertificate = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnSave != null)
            {
                BtnSave.Dispose();
                BtnSave = null;
            }

            if (CbDisabled != null)
            {
                CbDisabled.Dispose();
                CbDisabled = null;
            }

            if (ImageView != null)
            {
                ImageView.Dispose();
                ImageView = null;
            }

            if (TxtDescription != null)
            {
                TxtDescription.Dispose();
                TxtDescription = null;
            }

            if (TxtName != null)
            {
                TxtName.Dispose();
                TxtName = null;
            }

            if (TxtIssuer != null)
            {
                TxtIssuer.Dispose();
                TxtIssuer = null;
            }

            if (TxtValidFrom != null)
            {
                TxtValidFrom.Dispose();
                TxtValidFrom = null;
            }

            if (TxtValidTo != null)
            {
                TxtValidTo.Dispose();
                TxtValidTo = null;
            }

            if (TxtDC != null)
            {
                TxtDC.Dispose();
                TxtDC = null;
            }
        }
Пример #46
0
        private void InitComponent()
        {
            try
            {
                ViewPagerView       = FindViewById <ViewPager>(Resource.Id.pager);
                CircleIndicatorView = FindViewById <CircleIndicator>(Resource.Id.indicator);

                TxtProductPrice       = (TextView)FindViewById(Resource.Id.tv_price);
                TxtProductNew         = (TextView)FindViewById(Resource.Id.BoleanNew);
                TxtProductInStock     = (TextView)FindViewById(Resource.Id.BoleanInStock);
                TxtProductDescription = (SuperTextView)FindViewById(Resource.Id.tv_description);
                TxtProductLocation    = (TextView)FindViewById(Resource.Id.tv_Location);
                TxtProductCardName    = (TextView)FindViewById(Resource.Id.card_name);
                TxtProductTime        = (TextView)FindViewById(Resource.Id.card_dist);

                BtnContact = (Button)FindViewById(Resource.Id.cont);

                UserImageAvatar = (ImageView)FindViewById(Resource.Id.card_pro_pic);
                ImageMore       = (ImageView)FindViewById(Resource.Id.Image_more);
                IconBack        = (ImageView)FindViewById(Resource.Id.iv_back);


                BtnLike    = FindViewById <LinearLayout>(Resource.Id.linerlike);
                BtnComment = FindViewById <LinearLayout>(Resource.Id.linercomment);

                MainSectionButton = FindViewById <LinearLayout>(Resource.Id.mainsection);
                BtnWonder         = FindViewById <LinearLayout>(Resource.Id.linerSecondReaction);
                ImgWonder         = FindViewById <ImageView>(Resource.Id.image_SecondReaction);
                TxtWonder         = FindViewById <TextView>(Resource.Id.SecondReactionText);

                LikeButton = FindViewById <ReactButton>(Resource.Id.beactButton);

                if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine || AppSettings.PostButton == PostButtonSystem.Like)
                {
                    MainSectionButton.WeightSum = 2;
                    BtnWonder.Visibility        = ViewStates.Gone;
                }
                else if (AppSettings.PostButton == PostButtonSystem.Wonder)
                {
                    MainSectionButton.WeightSum = 3;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    ImgWonder.SetImageResource(Resource.Drawable.ic_action_wowonder);
                    TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Wonder);
                }
                else if (AppSettings.PostButton == PostButtonSystem.DisLike)
                {
                    MainSectionButton.WeightSum = 3;
                    BtnWonder.Visibility        = ViewStates.Visible;

                    ImgWonder.SetImageResource(Resource.Drawable.ic_action_dislike);
                    TxtWonder.Text = Application.Context.GetText(Resource.String.Btn_Dislike);
                }

                if (!AppSettings.SetTabDarkTheme)
                {
                    ImageMore.SetColorFilter(Color.Black);
                }

                if (AppSettings.FlowDirectionRightToLeft)
                {
                    IconBack.SetImageResource(Resource.Drawable.ic_action_ic_back_rtl);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                if (_titleViewRenderer != null)
                {
                    Android.Platform.ClearRenderer(_titleViewRenderer.View);
                    _titleViewRenderer.Dispose();
                    _titleViewRenderer = null;
                }

                _toolbar.RemoveView(_titleView);
                _titleView?.Dispose();
                _titleView = null;

                _toolbar.RemoveView(_titleIconView);
                _titleIconView?.Dispose();
                _titleIconView = null;

                _imageSource = null;

                if (_toolbarTracker != null)
                {
                    _toolbarTracker.CollectionChanged -= ToolbarTrackerOnCollectionChanged;
                    _toolbarTracker.Target             = null;
                    _toolbarTracker = null;
                }

                if (_toolbar != null)
                {
                    _toolbar.SetNavigationOnClickListener(null);
                    _toolbar.Dispose();
                    _toolbar = null;
                }

                if (_drawerLayout != null && _drawerListener != null)
                {
                    _drawerLayout.RemoveDrawerListener(_drawerListener);
                }

                if (_drawerListener != null)
                {
                    _drawerListener.Dispose();
                    _drawerListener = null;
                }

                if (_drawerToggle != null)
                {
                    _drawerToggle.Dispose();
                    _drawerToggle = null;
                }

                if (_backgroundDrawable != null)
                {
                    _backgroundDrawable.Dispose();
                    _backgroundDrawable = null;
                }

                Current = null;

                // We dispose the child renderers after cleaning up everything related to DrawerLayout in case
                // one of the children is a MasterDetailPage (which may dispose of the DrawerLayout).
                if (Element != null)
                {
                    foreach (Element element in PageController.InternalChildren)
                    {
                        var child = element as VisualElement;
                        if (child == null)
                        {
                            continue;
                        }

                        IVisualElementRenderer renderer = Android.Platform.GetRenderer(child);
                        renderer?.Dispose();
                    }

                    var navController = NavigationPageController;

                    navController.PushRequested             -= OnPushed;
                    navController.PopRequested              -= OnPopped;
                    navController.PopToRootRequested        -= OnPoppedToRoot;
                    navController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
                    navController.RemovePageRequested       -= OnRemovePageRequested;
                }

                Device.Info.PropertyChanged -= DeviceInfoPropertyChanged;

                // API only exists on newer android YAY
                if ((int)Build.VERSION.SdkInt >= 17)
                {
                    FragmentManager fm = FragmentManager;

                    if (!fm.IsDestroyed)
                    {
                        FragmentTransaction trans = fm.BeginTransactionEx();
                        foreach (Fragment fragment in _fragmentStack)
                        {
                            trans.RemoveEx(fragment);
                        }
                        trans.CommitAllowingStateLossEx();
                        fm.ExecutePendingTransactionsEx();
                    }
                }
            }

            base.Dispose(disposing);
        }
Пример #48
0
        protected virtual void LoadView(IShellContext shellContext)
        {
            Profile.FrameBegin();

            var context = shellContext.AndroidContext;

            // Android designer can't load fragments or resources from layouts
            if (context.IsDesignerContext())
            {
                _rootView = new FrameLayout(context);
                return;
            }

            var coordinator = (ViewGroup)LayoutInflater.FromContext(context).Inflate(Resource.Layout.FlyoutContent, null);

            Profile.FramePartition("Find AppBar");
            _appBar = coordinator.FindViewById <AppBarLayout>(Resource.Id.flyoutcontent_appbar);

            _rootView = coordinator as ViewGroup;

            Profile.FramePartition("Add Listener");
            _appBar.AddOnOffsetChangedListener(this);

            Profile.FramePartition("Add HeaderView");
            _actionBarHeight = (int)context.ToPixels(56);
            UpdateFlyoutHeader();

            UpdateFlyoutContent();

            Profile.FramePartition("Initialize BgImage");
            var metrics = context.Resources.DisplayMetrics;
            var width   = Math.Min(metrics.WidthPixels, metrics.HeightPixels);

            using (TypedValue tv = new TypedValue())
            {
                if (context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ActionBarSize, tv, true))
                {
                    _actionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, metrics);
                }
            }

            width -= _actionBarHeight;

            coordinator.LayoutParameters = new LP(width, LP.MatchParent);

            _bgImage = new ImageView(context)
            {
                LayoutParameters = new LP(coordinator.LayoutParameters)
            };

            Profile.FramePartition("UpdateFlyoutHeaderBehavior");
            UpdateFlyoutHeaderBehavior();
            _shellContext.Shell.PropertyChanged += OnShellPropertyChanged;

            Profile.FramePartition("UpdateFlyoutBackground");
            UpdateFlyoutBackground();

            Profile.FramePartition(nameof(UpdateVerticalScrollMode));
            UpdateVerticalScrollMode();

            Profile.FramePartition("FlyoutFooter");
            UpdateFlyoutFooter();

            Profile.FrameEnd();

            if (View is ShellFlyoutLayout sfl)
            {
                sfl.LayoutChanging += OnFlyoutViewLayoutChanged;
            }
        }
 public FileListRowViewHolder(TextView textView, ImageView imageView)
 {
     TextView  = textView;
     ImageView = imageView;
 }
Пример #50
0
        private void ini()
        {
            mainLayout = new RelativeLayout(context);
            mainLayout.LayoutParameters = new RelativeLayout.LayoutParams(-1, -1);
            mainLayout.SetBackgroundColor(Color.ParseColor("#ffffff"));

            linearContainer = new LinearLayout(context);
            linearImageLO   = new LinearLayout(context);
            linearTextLO    = new LinearLayout(context);
            linearLike      = new LinearLayout(context);

            linearUsers = new LinearLayout(context);

            txtAuthor  = new TextView(context);
            txtChapter = new TextView(context);
            txtNameLO  = new TextView(context);
            txtLike    = new TextView(context);


            txtAuthor.Typeface  = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
            txtChapter.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
            txtNameLO.Typeface  = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
            txtLike.Typeface    = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");


            imgHeart = new ImageView(context);

            commentList = new ListView(context);

            linearContainer.LayoutParameters = new LinearLayout.LayoutParams(-1, -1);
            linearImageLO.LayoutParameters   = new LinearLayout.LayoutParams(-1, Configuration.getHeight(372));
            linearTextLO.LayoutParameters    = new LinearLayout.LayoutParams(-1, Configuration.getHeight(250));
            linearLike.LayoutParameters      = new LinearLayout.LayoutParams(Configuration.getWidth(120), Configuration.getHeight(80));
            linearUsers.LayoutParameters     = new LinearLayout.LayoutParams(-1, -2);

            linearTextLO.Orientation = Orientation.Vertical;
            linearTextLO.SetGravity(GravityFlags.Right);

            linearLike.Orientation = Orientation.Vertical;
            linearLike.SetGravity(GravityFlags.Center);

            linearUsers.Orientation = Orientation.Horizontal;
            linearUsers.SetGravity(GravityFlags.Center);

            linearContainer.Orientation = Orientation.Vertical;
            //linearContainer.SetGravity (GravityFlags.Center);

            //Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondounidad.png"), 480, 640, true));
            //linearImageLO.SetBackgroundDrawable (d);

            imgHeart.SetImageBitmap(Bitmap.CreateScaledBitmap(getBitmapFromAsset("images/like.png"), Configuration.getWidth(43), Configuration.getHeight(43), true));


            txtAuthor.Text  = "Author : David Spencer";
            txtChapter.Text = "Flora y Fauna";
            txtNameLO.Text  = "Camino Inca";
            txtLike.Text    = "10";

            //txtChapter.SetMaxWidth (Configuration.getWidth (580));
            //txtChapter.Ellipsize = TextUtils.TruncateAt.End;
            //txtChapter.SetMaxLines(1);



            txtAuthor.SetTextColor(Color.ParseColor("#ffffff"));
            txtChapter.SetTextColor(Color.ParseColor("#ffffff"));
            txtNameLO.SetTextColor(Color.ParseColor("#ffffff"));
            txtLike.SetTextColor(Color.ParseColor("#ffffff"));

            txtNameLO.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(30));
            txtChapter.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(50));
            txtAuthor.SetTextSize(Android.Util.ComplexUnitType.Px, Configuration.getHeight(30));
            txtNameLO.Typeface = Typeface.DefaultBold;

            txtAuthor.Gravity  = GravityFlags.Right;
            txtChapter.Gravity = GravityFlags.Right;
            txtNameLO.Gravity  = GravityFlags.Right;
            txtLike.Gravity    = GravityFlags.Center;

            linearTextLO.AddView(txtNameLO);
            linearTextLO.AddView(txtChapter);
            linearTextLO.AddView(txtAuthor);

            linearTextLO.SetPadding(0, 0, Configuration.getWidth(30), 0);

            linearLike.AddView(imgHeart);
            linearLike.AddView(txtLike);


            _mCommentData = new List <CommentDataRow> ();

            /*
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             * _mCommentData.Add (new CommentDataRow (){im_profile="images/e1.jpg" , name="Ryan Elliot", date = "10:00pm", comment = "Esto es un comentario" });
             */
//			commentList.Adapter = new CommentListViewAdapter (context, _mCommentData);
            commentList.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(654));


            commentList.SetX(0); commentList.SetY(Configuration.getHeight(530));

            linearTextLO.SetX(0); linearTextLO.SetY(Configuration.getHeight(200));
            //linearImageLO.SetX (0); linearImageLO.SetY (0);
            linearLike.SetX(0); linearLike.SetY(Configuration.getHeight(256));
            linearContainer.SetX(0); linearContainer.SetY(0);

            linearContainer.AddView(linearImageLO);
            linearContainer.AddView(linearUsers);
            mainLayout.AddView(linearContainer);

            //mainLayout.AddView (linearImageLO);
            mainLayout.AddView(linearTextLO);

            mainLayout.AddView(linearLike);
            mainLayout.AddView(commentList);

            this.AddView(mainLayout);

            /*linearImageLO.Click += delegate {
             *      var com = ((LOViewModel)context.DataContext).SignUpCommand;
             *      com.Execute(null);
             * };
             */
        }
Пример #51
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (IsThereAnAppToTakePictures())
            {
                CreateDirectoryForPictures();
            }
            SetContentView(Resource.Layout.PerritoNuevo);
            addButton       = FindViewById <Button>(Resource.Id.addButton);
            cameraButton    = FindViewById <ImageButton>(Resource.Id.cameraButton);
            nombreText      = FindViewById <EditText>(Resource.Id.nombreText);
            edadText        = FindViewById <EditText>(Resource.Id.edadText);
            descripcionText = FindViewById <EditText>(Resource.Id.descText);
            tipoSpin        = FindViewById <Spinner>(Resource.Id.tipoSpinner);
            fotoView        = FindViewById <ImageView>(Resource.Id.fotoImg);

            fotoView.Visibility = ViewStates.Invisible;

            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.tipo_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            tipoSpin.Adapter = adapter;

            addButton.Click += ClickAdd;

            cameraButton.Click += ClickCamera;

            nombreText.FocusChange      += focusTextField;
            descripcionText.FocusChange += focusTextField;
            edadText.FocusChange        += focusTextField;

            user = new Usuario(Intent.GetIntExtra("id_user", 0), Intent.GetStringExtra("nombre"), Intent.GetStringExtra("access_token"), Intent.GetStringExtra("username"), Intent.GetIntExtra("roles", 0));

            id = Intent.GetIntExtra("position", -1);

            conMas = new ConectorMascota(user);


            if (id > 0)
            {
                cameraButton.Visibility = ViewStates.Gone;
                mascota = await conMas.ObtenerID(id);

                nombreText.Text      = mascota.nombre;
                edadText.Text        = mascota.edad.ToString();
                descripcionText.Text = mascota.descripcion;
                if (mascota.tipo == 1)
                {
                    tipoSpin.SetSelection(0);
                }
                else
                {
                    tipoSpin.SetSelection(1);
                }
            }


            // Create your application here
        }
 /// <summary>
 ///   This method will update the TextView and the ImageView that are
 ///   are
 /// </summary>
 /// <param name="fileName"> </param>
 /// <param name="fileImageResourceId"> </param>
 public void Update(string fileName, int fileImageResourceId)
 {
     TextView.Text = fileName;
     ImageView.SetImageResource(fileImageResourceId);
 }
Пример #53
0
                public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView
                                                                   , ViewGroup parent)
                {
                    if (convertView == null)
                    {
                        LayoutInflater inflater = (LayoutInflater)parent.GetContext().GetSystemService(Context
                                                                                                       .LayoutInflaterService);
                        convertView = inflater.Inflate(Resource.Layout.view_task, null);
                    }
                    Couchbase.Lite.Document task   = (Couchbase.Lite.Document) this.GetItem(position);
                    Bitmap             image       = null;
                    Bitmap             thumbnail   = null;
                    IList <Attachment> attachments = task.GetCurrentRevision().GetAttachments();

                    if (attachments != null && attachments.Count > 0)
                    {
                        Attachment attachment = attachments[0];
                        try
                        {
                            image     = BitmapFactory.DecodeStream(attachment.GetContent());
                            thumbnail = ThumbnailUtils.ExtractThumbnail(image, MainActivity.TasksFragment.ThumbnailSizePx
                                                                        , MainActivity.TasksFragment.ThumbnailSizePx);
                        }
                        catch (Exception e)
                        {
                            Log.E(Application.Tag, "Cannot decode the attached image", e);
                        }
                    }
                    Bitmap    displayImage = image;
                    ImageView imageView    = (ImageView)convertView.FindViewById(Resource.Id.image);

                    if (thumbnail != null)
                    {
                        imageView.SetImageBitmap(thumbnail);
                    }
                    else
                    {
                        imageView.SetImageDrawable(this._enclosing.GetResources().GetDrawable(Resource.Drawable.
                                                                                              ic_camera_light));
                    }
                    imageView.Click += async(sender, e) => {
                        if (displayImage != null)
                        {
                            DispatchImageViewIntent(displayImage);
                        }
                        else
                        {
                            AttachImage(task);
                        }
                    };
                    TextView text = (TextView)convertView.FindViewById(Resource.Id.text);

                    text.SetText((string)task.GetProperty("title"));
                    CheckBox checkBox        = (CheckBox)convertView.FindViewById(Resource.Id.@checked);
                    bool     checkedProperty = (bool)task.GetProperty("checked");
                    bool     @checked        = checkedProperty != null ? checkedProperty : false;

                    checkBox.SetChecked(@checked);
                    checkBox.Click += async(sender, e) => {
                        try
                        {
                            Task.UpdateCheckedStatus(task, checkBox.IsChecked());
                        }
                        catch (CouchbaseLiteException ex)
                        {
                            Log.E(((CouchbaseSample.Android.Application)Application).Tag, "Cannot update checked status", e);
                        }
                    };
                    return(convertView);
                }
Пример #54
0
        internal static VulkanImage Texture2D(VulkanContext ctx, TextureData tex2D)
        {
            Buffer stagingBuffer = ctx.Device.CreateBuffer(
                new BufferCreateInfo(tex2D.Mipmaps[0].Size, BufferUsages.TransferSrc));
            MemoryRequirements stagingMemReq = stagingBuffer.GetMemoryRequirements();
            int heapIndex = ctx.MemoryProperties.MemoryTypes.IndexOf(
                stagingMemReq.MemoryTypeBits, MemoryProperties.HostVisible);
            DeviceMemory stagingMemory = ctx.Device.AllocateMemory(
                new MemoryAllocateInfo(stagingMemReq.Size, heapIndex));

            stagingBuffer.BindMemory(stagingMemory);

            IntPtr ptr = stagingMemory.Map(0, stagingMemReq.Size);

            Interop.Write(ptr, tex2D.Mipmaps[0].Data);
            stagingMemory.Unmap();

            // Setup buffer copy regions for each mip level.
            var bufferCopyRegions = new BufferImageCopy[tex2D.Mipmaps.Length];
            int offset            = 0;

            for (int i = 0; i < bufferCopyRegions.Length; i++)
            {
                bufferCopyRegions = new[]
                {
                    new BufferImageCopy
                    {
                        ImageSubresource = new ImageSubresourceLayers(ImageAspects.Color, i, 0, 1),
                        ImageExtent      = tex2D.Mipmaps[0].Extent,
                        BufferOffset     = offset
                    }
                };
                offset += tex2D.Mipmaps[i].Size;
            }

            // Create optimal tiled target image.
            Image image = ctx.Device.CreateImage(new ImageCreateInfo
            {
                ImageType     = ImageType.Image2D,
                Format        = tex2D.Format,
                MipLevels     = tex2D.Mipmaps.Length,
                ArrayLayers   = 1,
                Samples       = SampleCounts.Count1,
                Tiling        = ImageTiling.Optimal,
                SharingMode   = SharingMode.Exclusive,
                InitialLayout = ImageLayout.Undefined,
                Extent        = tex2D.Mipmaps[0].Extent,
                Usage         = ImageUsages.Sampled | ImageUsages.TransferDst
            });
            MemoryRequirements imageMemReq = image.GetMemoryRequirements();
            int imageHeapIndex             = ctx.MemoryProperties.MemoryTypes.IndexOf(
                imageMemReq.MemoryTypeBits, MemoryProperties.DeviceLocal);
            DeviceMemory memory = ctx.Device.AllocateMemory(new MemoryAllocateInfo(imageMemReq.Size, imageHeapIndex));

            image.BindMemory(memory);

            var subresourceRange = new ImageSubresourceRange(ImageAspects.Color, 0, tex2D.Mipmaps.Length, 0, 1);

            // Copy the data from staging buffers to device local buffers.
            CommandBuffer cmdBuffer = ctx.GraphicsCommandPool.AllocateBuffers(new CommandBufferAllocateInfo(CommandBufferLevel.Primary, 1))[0];

            cmdBuffer.Begin(new CommandBufferBeginInfo(CommandBufferUsages.OneTimeSubmit));
            cmdBuffer.CmdPipelineBarrier(PipelineStages.TopOfPipe, PipelineStages.TopOfPipe,
                                         imageMemoryBarriers: new[]
            {
                new ImageMemoryBarrier(
                    image, subresourceRange,
                    0, Accesses.TransferWrite,
                    ImageLayout.Undefined, ImageLayout.TransferDstOptimal)
            });
            cmdBuffer.CmdCopyBufferToImage(stagingBuffer, image, ImageLayout.TransferDstOptimal, bufferCopyRegions);
            cmdBuffer.CmdPipelineBarrier(PipelineStages.TopOfPipe, PipelineStages.TopOfPipe,
                                         imageMemoryBarriers: new[]
            {
                new ImageMemoryBarrier(
                    image, subresourceRange,
                    Accesses.TransferWrite, Accesses.ShaderRead,
                    ImageLayout.TransferDstOptimal, ImageLayout.ShaderReadOnlyOptimal)
            });
            cmdBuffer.End();

            // Submit.
            Fence fence = ctx.Device.CreateFence();

            ctx.GraphicsQueue.Submit(new SubmitInfo(commandBuffers: new[] { cmdBuffer }), fence);
            fence.Wait();

            // Cleanup staging resources.
            fence.Dispose();
            stagingMemory.Dispose();
            stagingBuffer.Dispose();

            // Create image view.
            ImageView view = image.CreateView(new ImageViewCreateInfo(tex2D.Format, subresourceRange));

            return(new VulkanImage(image, memory, view, tex2D.Format));
        }
Пример #55
0
 protected override void InitializeViews()
 {
     checkedImage  = ItemView.FindViewById <ImageView>(Resource.Id.SettingsWorkspaceCellCheckedImageView);
     workspaceName = ItemView.FindViewById <TextView>(Resource.Id.SettingsWorkspaceCellWorkspaceNameTextView);
 }
Пример #56
0
 public override void OnActivityResult(int requestCode, int resultCode, Intent data
                                       )
 {
     base.OnActivityResult(requestCode, resultCode, data);
     if (resultCode != ResultOk)
     {
         if (mCurrentTaskToAttachImage != null)
         {
             mCurrentTaskToAttachImage = null;
         }
         return;
     }
     if (requestCode == RequestTakePhoto)
     {
         mImageToBeAttached = BitmapFactory.DecodeFile(mImagePathToBeAttached);
         // Delete the temporary image file
         FilePath file = new FilePath(mImagePathToBeAttached);
         file.Delete();
         mImagePathToBeAttached = null;
     }
     else
     {
         if (requestCode == RequestChoosePhoto)
         {
             try
             {
                 Uri uri = data.GetData();
                 mImageToBeAttached = MediaStore.Images.Media.GetBitmap(Activity.GetContentResolver
                                                                            (), uri);
             }
             catch (IOException e)
             {
                 Log.E(Application.Tag, "Cannot get a selected photo from the gallery.", e);
             }
         }
     }
     if (mImageToBeAttached != null)
     {
         if (mCurrentTaskToAttachImage != null)
         {
             try
             {
                 Task.AttachImage(mCurrentTaskToAttachImage, mImageToBeAttached);
             }
             catch (CouchbaseLiteException e)
             {
                 Log.E(Application.Tag, "Cannot attach an image to a task.", e);
             }
         }
         else
         {
             // Attach an image for a new task
             Bitmap thumbnail = ThumbnailUtils.ExtractThumbnail(mImageToBeAttached, ThumbnailSizePx
                                                                , ThumbnailSizePx);
             ImageView imageView = (ImageView)Activity.FindViewById(Resource.Id.image);
             imageView.SetImageBitmap(thumbnail);
         }
     }
     // Ensure resetting the task to attach an image
     if (mCurrentTaskToAttachImage != null)
     {
         mCurrentTaskToAttachImage = null;
     }
 }
Пример #57
0
        protected void ApplyAttributes(View view, ViewAttributes attrs)
        {
            if (view == null || attrs == null)
            {
                return;
            }

            if (attrs.Position2D != null)
            {
                view.Position2D = attrs.Position2D;
            }
            if (attrs.Size2D != null)
            {
                view.Size2D = attrs.Size2D;
            }
            if (attrs.MinimumSize != null)
            {
                view.MinimumSize = attrs.MinimumSize;
            }
            if (attrs.BackgroundColor?.GetValue(State) != null)
            {
                view.BackgroundColor = attrs.BackgroundColor.GetValue(State);
            }
            if (attrs.PositionUsesPivotPoint != null)
            {
                view.PositionUsesPivotPoint = attrs.PositionUsesPivotPoint.Value;
            }
            if (attrs.ParentOrigin != null)
            {
                view.ParentOrigin = attrs.ParentOrigin;
            }
            if (attrs.PivotPoint != null)
            {
                view.PivotPoint = attrs.PivotPoint;
            }
            if (attrs.WidthResizePolicy != null)
            {
                view.WidthResizePolicy = attrs.WidthResizePolicy.Value;
            }
            if (attrs.HeightResizePolicy != null)
            {
                view.HeightResizePolicy = attrs.HeightResizePolicy.Value;
            }
            if (attrs.SizeModeFactor != null)
            {
                view.SizeModeFactor = attrs.SizeModeFactor;
            }
            if (attrs.Opacity?.GetValue(State) != null)
            {
                view.Opacity = attrs.Opacity.GetValue(State).Value;
            }

            ImageView       image      = view as ImageView;
            ImageAttributes imageAttrs = attrs as ImageAttributes;

            if (image != null && imageAttrs != null)
            {
                if (imageAttrs.ResourceUrl?.GetValue(State) != null)
                {
                    image.ResourceUrl = imageAttrs.ResourceUrl.GetValue(State);
                }
                if (imageAttrs.Border?.GetValue(State) != null)
                {
                    image.Border = imageAttrs.Border.GetValue(State);
                }
            }

            TextLabel      text      = view as TextLabel;
            TextAttributes textAttrs = attrs as TextAttributes;

            if (text != null && textAttrs != null)
            {
                if (textAttrs.Text?.GetValue(State) != null)
                {
                    text.Text = textAttrs.Text.GetValue(State);
                }
                if (textAttrs.TranslatableText?.GetValue(State) != null)
                {
                    text.TranslatableText = textAttrs.TranslatableText.GetValue(State);
                }
                if (textAttrs.MultiLine != null)
                {
                    text.MultiLine = textAttrs.MultiLine.Value;
                }
                if (textAttrs.HorizontalAlignment != null)
                {
                    text.HorizontalAlignment = textAttrs.HorizontalAlignment.Value;
                }
                if (textAttrs.VerticalAlignment != null)
                {
                    text.VerticalAlignment = textAttrs.VerticalAlignment.Value;
                }
                if (textAttrs.EnableMarkup != null)
                {
                    text.EnableMarkup = textAttrs.EnableMarkup.Value;
                }
                if (textAttrs.AutoScrollLoopCount != null)
                {
                    text.AutoScrollLoopCount = textAttrs.AutoScrollLoopCount.Value;
                }
                if (textAttrs.AutoScrollSpeed != null)
                {
                    text.AutoScrollSpeed = textAttrs.AutoScrollSpeed.Value;
                }
                if (textAttrs.AutoScrollGap != null)
                {
                    text.AutoScrollGap = textAttrs.AutoScrollGap.Value;
                }
                if (textAttrs.AutoScrollLoopDelay != null)
                {
                    text.AutoScrollLoopDelay = textAttrs.AutoScrollLoopDelay.Value;
                }
                if (textAttrs.AutoScrollStopMode != null)
                {
                    text.AutoScrollStopMode = textAttrs.AutoScrollStopMode.Value;
                }
                if (textAttrs.LineSpacing != null)
                {
                    text.LineSpacing = textAttrs.LineSpacing.Value;
                }
                if (textAttrs.TextColor?.GetValue(State) != null)
                {
                    text.TextColor = textAttrs.TextColor.GetValue(State);
                }
                if (textAttrs.FontFamily != null)
                {
                    text.FontFamily = textAttrs.FontFamily;
                }
                if (textAttrs.PointSize?.GetValue(State) != null)
                {
                    text.PointSize = textAttrs.PointSize.GetValue(State).Value;
                }

                int thickness = 0;

                if (textAttrs.OutstrokeThickness?.GetValue(State) != null)
                {
                    thickness = textAttrs.OutstrokeThickness.GetValue(State).Value;
                }
                if (textAttrs.OutstrokeColor?.GetValue(State) != null)
                {
                    Color       outstrokeColor = textAttrs.OutstrokeColor.GetValue(State);
                    PropertyMap outlineMap     = new PropertyMap();
                    outlineMap.Add("color", new PropertyValue(new Color(outstrokeColor.R, outstrokeColor.G, outstrokeColor.B, outstrokeColor.A)));
                    outlineMap.Add("width", new PropertyValue(thickness));
                    text.Outline = outlineMap;
                }
                else
                {
                    text.Outline = new PropertyMap();
                }
            }

            TextField           textField      = view as TextField;
            TextFieldAttributes textFieldAttrs = attrs as TextFieldAttributes;

            if (textField != null && textFieldAttrs != null)
            {
                if (textFieldAttrs.Text?.GetValue(State) != null)
                {
                    textField.Text = textFieldAttrs.Text.GetValue(State);
                }
                if (textFieldAttrs.PlaceholderText?.GetValue(State) != null)
                {
                    textField.PlaceholderText = textFieldAttrs.PlaceholderText.GetValue(State);
                }
                if (textFieldAttrs.TranslatablePlaceholderText?.GetValue(State) != null)
                {
                    textField.TranslatablePlaceholderText = textFieldAttrs.TranslatablePlaceholderText.GetValue(State);
                }
                if (textFieldAttrs.HorizontalAlignment != null)
                {
                    textField.HorizontalAlignment = textFieldAttrs.HorizontalAlignment.Value;
                }
                if (textFieldAttrs.VerticalAlignment != null)
                {
                    textField.VerticalAlignment = textFieldAttrs.VerticalAlignment.Value;
                }
                if (textFieldAttrs.EnableMarkup != null)
                {
                    textField.EnableMarkup = textFieldAttrs.EnableMarkup.Value;
                }
                if (textFieldAttrs.TextColor?.GetValue(State) != null)
                {
                    textField.TextColor = textFieldAttrs.TextColor.GetValue(State);
                }
                if (textFieldAttrs.PlaceholderTextColor?.GetValue(State) != null)
                {
                    textField.PlaceholderTextColor = textFieldAttrs.PlaceholderTextColor.GetValue(State);
                }
                if (textFieldAttrs.PrimaryCursorColor?.GetValue(State) != null)
                {
                    textField.PrimaryCursorColor = textFieldAttrs.PrimaryCursorColor.GetValue(State);
                }
                if (textFieldAttrs.SecondaryCursorColor?.GetValue(State) != null)
                {
                    textField.SecondaryCursorColor = textFieldAttrs.SecondaryCursorColor.GetValue(State);
                }
                if (textFieldAttrs.FontFamily != null)
                {
                    textField.FontFamily = textFieldAttrs.FontFamily;
                }
                if (textFieldAttrs.PointSize?.GetValue(State) != null)
                {
                    textField.PointSize = textFieldAttrs.PointSize.GetValue(State).Value;
                }
                if (textFieldAttrs.EnableCursorBlink != null)
                {
                    textField.EnableCursorBlink = textFieldAttrs.EnableCursorBlink.Value;
                }
                if (textFieldAttrs.EnableSelection != null)
                {
                    textField.EnableSelection = textFieldAttrs.EnableSelection.Value;
                }
                if (textFieldAttrs.CursorWidth != null)
                {
                    textField.CursorWidth = textFieldAttrs.CursorWidth.Value;
                }
                if (textFieldAttrs.EnableEllipsis != null)
                {
                    textField.Ellipsis = textFieldAttrs.EnableEllipsis.Value;
                }
            }
        }
Пример #58
0
        private bool btnNextEnable = false, btnDoneEnable = true;// boolean to enable button next and button done
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "Calculation" layout resource
            SetContentView(Resource.Layout.CalculationLayout);
            // Assign variables to the layout resources
            btnHome = FindViewById <Button>(Resource.Id.btnHome);
            btnNext = FindViewById <Button>(Resource.Id.btnNext);
            btnDone = FindViewById <Button>(Resource.Id.btnDone);

            txtQuestion  = FindViewById <TextView>(Resource.Id.txtQuestion);
            txtJudgement = FindViewById <TextView>(Resource.Id.txtJudgement);
            txtAnswer    = FindViewById <EditText>(Resource.Id.txtAnswer);

            judgeImg = FindViewById <ImageView>(Resource.Id.judgementImage);
            //If app state changes, retrieve saved information
            //If app state doesn't change, start new screen with new value.
            if (savedInstanceState != null)
            {
                x = savedInstanceState.GetInt("x value", 0);
                y = savedInstanceState.GetInt("y value", 0);
                txtAnswer.Text    = savedInstanceState.GetString("answer", "");
                txtJudgement.Text = savedInstanceState.GetString("judgement", "");
                if (txtJudgement.Text == "Please answer!")
                {
                    txtJudgement.SetTextColor(Android.Graphics.Color.Black);
                    judgeImg.SetImageResource(0);
                }
                else if (txtJudgement.Text == "Correct!!!")
                {
                    txtJudgement.SetTextColor(Android.Graphics.Color.DarkGreen);
                    judgeImg.SetImageResource(Resource.Drawable.correct);
                }
                else if (txtJudgement.Text == "Incorrect!!!")
                {
                    txtJudgement.SetTextColor(Android.Graphics.Color.Red);
                    judgeImg.SetImageResource(Resource.Drawable.incorrect);
                }
                txtQuestion.Text = x.ToString() + " + " + y.ToString() + " = ?";
                btnNextEnable    = savedInstanceState.GetBoolean("nextEnable", false);
                btnDoneEnable    = savedInstanceState.GetBoolean("doneEnable", true);
                CheckEnable();
            }
            else
            {
                GetQuestion();
                CheckEnable();
            }
            //Event is triggered when Done button is clicked.
            //Answer value will be checked and judgement will be displayed accordingly
            //If no answer, remind text will appear.
            //If answer is correct, correct text will appear
            //If answer is incorrect, incorrect text will appear
            btnDone.Click += delegate {
                if (txtAnswer.Text == "")
                {
                    txtJudgement.Text = "Please answer!";
                    txtJudgement.SetTextColor(Android.Graphics.Color.Black);
                    judgeImg.SetImageResource(0);
                }
                else
                {
                    int tmp = Int32.Parse(txtAnswer.Text);
                    if (tmp == x + y)
                    {
                        txtJudgement.Text = "Correct!!!";
                        txtJudgement.SetTextColor(Android.Graphics.Color.DarkGreen);
                        judgeImg.SetImageResource(Resource.Drawable.correct);
                    }
                    else
                    {
                        txtJudgement.Text = "Incorrect!!!";
                        txtJudgement.SetTextColor(Android.Graphics.Color.Red);
                        judgeImg.SetImageResource(Resource.Drawable.incorrect);
                    }
                    btnDoneEnable = false;
                    btnNextEnable = true;
                }
                CheckEnable();
            };
            //Event is triggered when Next button is clicked
            //Next question will appear.
            btnNext.Click += delegate {
                GetQuestion();
                txtJudgement.Text = "";
                txtAnswer.Text    = "";
                judgeImg.SetImageResource(0);
                btnDoneEnable = true;
                btnNextEnable = false;
                CheckEnable();
            };
            //Event triggered when Home button is clicked
            //Home screen will be displayed
            btnHome.Click += delegate {
                var newActivity = new Intent(this, typeof(MainActivity));
                StartActivity(newActivity);
            };
        }
Пример #59
0
        public void Init()
        {
            var tex    = Texture2D.whiteTexture;
            var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.one * 0.5f, 100, 1);


            _songAudioSource = Plugin.AudioTimeSync.GetPrivateField <AudioSource>("_audioSource");
            var rectTransform = transform as RectTransform;

            rectTransform.anchorMin        = Vector2.right * 0.5f;
            rectTransform.anchorMax        = Vector2.right * 0.5f;
            rectTransform.sizeDelta        = ParentSize;
            rectTransform.anchoredPosition = new Vector2(0, 16);

            _seekBackg    = new GameObject("Background").AddComponent <ImageView>();
            rectTransform = _seekBackg.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.sizeDelta        = SeekBarSize + new Vector2(0, 7);
            rectTransform.anchoredPosition = new Vector2(0, -1);
            _seekBackg.sprite   = sprite;
            _seekBackg.type     = Image.Type.Simple;
            _seekBackg.color    = BackgroundColor;
            _seekBackg.material = Utilities.ImageResources.NoGlowMat;

            _seekBar      = new GameObject("Seek Bar").AddComponent <ImageView>();
            rectTransform = _seekBar.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.sizeDelta = SeekBarSize;

            _seekBar.sprite     = sprite;
            _seekBar.type       = Image.Type.Filled;
            _seekBar.fillMethod = Image.FillMethod.Horizontal;
            _seekBar.color      = ForegroundColor;
            _seekBar.material   = Utilities.ImageResources.NoGlowMat;

            _seekCursor   = new GameObject("Seek Cursor").AddComponent <ImageView>();
            rectTransform = _seekCursor.rectTransform;
            rectTransform.SetParent(_seekBar.transform, false);
            rectTransform.anchorMin = Vector2.up * 0.5f;
            rectTransform.anchorMax = Vector2.up * 0.5f;
            rectTransform.sizeDelta = SeekCursorSize;

            _seekCursor.sprite   = sprite;
            _seekCursor.type     = Image.Type.Simple;
            _seekCursor.color    = SeekCursorColor;
            _seekCursor.material = Utilities.ImageResources.NoGlowMat;



            _currentTime          = BeatSaberUI.CreateText(this.GetComponent <RectTransform>(), "0:00", new Vector2(-83f, -1f));
            _currentTime.fontSize = 5f;
            // rectTransform = _currentTime.rectTransform;
            // rectTransform.anchorMin = Vector2.up * 0.5f;
            //  rectTransform.anchorMax = Vector2.up * 0.5f;
            //   rectTransform.sizeDelta = TimeTextSize;
            //    rectTransform.anchoredPosition = new Vector2(-(TimeTextSize.x / 2) - TimeTextMargin, 0);
            //      _currentTime.enableAutoSizing = true;
            //   _currentTime.fontSizeMin = 1;
            _currentTime.alignment = TextAlignmentOptions.Right;

            _timeLength           = BeatSaberUI.CreateText(this.GetComponent <RectTransform>(), "0:00", new Vector2(87f, -1f));
            _timeLength.fontSize  = 5f;
            _timeLength.alignment = TextAlignmentOptions.Left;

            var looperObj = new GameObject("Looper UI");

            looperObj.transform.SetParent(_seekBar.rectTransform, false);
            rectTransform                  = looperObj.AddComponent <RectTransform>();
            rectTransform.sizeDelta        = SeekBarSize;
            rectTransform.anchoredPosition = new Vector2(0, LooperUITopMargin - 2f);
            _looperUI = looperObj.AddComponent <LooperUI>();
            _looperUI.Init(this);
            _looperUI.OnDragEndEvent += LooperUIOnOnDragEndEvent;

            if (_looperUI.StartTime != 0)
            {
                PlaybackPosition = _looperUI.StartTime;
                //       Invoke(nameof(ApplyPlaybackPosition), 0.1f);
                //     ApplyPlaybackPosition();
            }
            _mainCamera = Camera.main;
        }
Пример #60
0
 public OnClicklistener(ArcLayout arcLayout, ImageView hintView)
 {
     m_arcLayout = arcLayout;
     m_hintView  = hintView;
 }