Esempio n. 1
0
        void RefreshSample(SampleBase selectedSample)
        {
            SamplePage sample;

            bool isClassExists = Type.GetType("SampleBrowser." + selectedSample.Name) != null;

            if (isClassExists)
            {
                var handle = Activator.CreateInstance(null, "SampleBrowser." + selectedSample.Name);
                sample = (SamplePage)handle.Unwrap();
                sampleView.RemoveAllViews();

                if ((currentActivity as AllControlsSamplePage).currentSamplePage != null)
                {
                    (currentActivity as AllControlsSamplePage).currentSamplePage.Destroy();
                }

                (currentActivity as AllControlsSamplePage).currentSamplePage = sample;
                currentSamplePage = sample;
                sampleView.AddView(sample.GetSampleContent(this.View.Context));

                if (currentSamplePage.GetPropertyWindowLayout(currentActivity) != null)
                {
                    (currentActivity as AllControlsSamplePage).SettingsButton.Visibility = ViewStates.Visible;
                }
                else
                {
                    (currentActivity as AllControlsSamplePage).SettingsButton.Visibility = ViewStates.Invisible;
                }

                if (!selectedSample.Type.Equals(""))
                {
                    string toatText = "";
                    if (selectedSample.Type.ToLower().Equals("new"))
                    {
                        toatText = "New";
                    }
                    else if (selectedSample.Type.ToLower().Equals("updated"))
                    {
                        toatText = "Updated";
                    }
                    else if (selectedSample.Type.ToLower().Equals("preview"))
                    {
                        toatText = "Preview";
                    }

                    if (toastNotification != null)
                    {
                        toastNotification.Cancel();
                    }

                    toastNotification = Toast.MakeText(currentActivity, toatText, ToastLength.Short);
                    toastNotification.Show();
                }
            }
        }
        void RefreshSample(Sample selectedSample)
        {
            FrameLayout layout = (FrameLayout)FindViewById(Resource.Id.samplearea);

            layout.SetPadding(5, 5, 5, 5);
            layout.SetBackgroundColor(Color.White);
            selectedPageSample = selectedSample;
            ImageView settingsImage = (ImageView)FindViewById(Resource.Id.settings);

            if (propertyIndent != null && propertyWindow != null)
            {
                propertyWindow.Finish();
            }
            if (sample != null)
            {
                sample.Destroy();
            }
            propertyIndent = new Intent(this, typeof(PropertyWindow));
            TextView textView = (TextView)FindViewById(Resource.Id.title_text);

            textView.Text = selectedSample.Title;
            RelativeLayout settingButton = (RelativeLayout)FindViewById(Resource.Id.settingsParent);
            RelativeLayout textParent    = (RelativeLayout)FindViewById(Resource.Id.textParent);

            textParent.Click += (object sender, EventArgs e) => {
                OnBackButtonPressed();
            };
            bool isClassExists = Type.GetType("SampleBrowser." + selectedSample.Name) != null;

            if (isClassExists)
            {
                var handle = Activator.CreateInstance(null, "SampleBrowser." + selectedSample.Name);
                sample = (SamplePage)handle.Unwrap();
                layout.RemoveAllViews();
                layout.AddView(sample.GetSampleContent(this));
                if (sample.GetPropertyWindowLayout(this) == null)
                {
                    settingsImage.Visibility = ViewStates.Invisible;
                    settingButton.Clickable  = false;
                }
                else
                {
                    settingsImage.Visibility = ViewStates.Visible;
                    settingButton.Clickable  = true;
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowCustomEnabled(true);
            ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
            ActionBar.SetDisplayShowTitleEnabled(false);
            LayoutInflater mInflater   = LayoutInflater.From(this);
            View           mCustomView = mInflater.Inflate(Resource.Layout.CustomActionBar, null);
            RelativeLayout imageButton = (RelativeLayout)mCustomView.FindViewById(Resource.Id.imageButton);

            View propertyWindow = mInflater.Inflate(Resource.Layout.Propertywindow, null);
            View mainView       = mInflater.Inflate(Resource.Layout.layout, null);

            SettingsButton = imageButton;
            SetContentView(mainView);
            PopupWindow popup = new PopupWindow(propertyWindow, FrameLayout.LayoutParams.MatchParent,
                                                FrameLayout.LayoutParams.MatchParent);

            popup.Focusable     = true;
            popup.DismissEvent += Popup_DismissEvent;
            imageButton.Click  += delegate
            {
                popup.ContentView = propertyWindow;
                if (currentSamplePage.PropertyView == null)
                {
                    currentSamplePage.PropertyView = currentSamplePage.GetPropertyWindowLayout(this);
                }
                LinearLayout linear = (LinearLayout)propertyWindow.FindViewById(Resource.Id.container);
                linear.RemoveAllViews();
                linear.AddView(currentSamplePage.PropertyView);
                if (isselected)
                {
                    popup.ShowAsDropDown(imageButton, 0, 280);
                    popup.Focusable = true;
                    popup.Update();

                    isselected = false;
                }


                ImageView iconclose = (ImageView)propertyWindow.FindViewById(Resource.Id.close);
                Button    discard   = (Button)propertyWindow.FindViewById(Resource.Id.discard);
                Button    apply     = (Button)propertyWindow.FindViewById(Resource.Id.apply);

                iconclose.Click += delegate
                {
                    popup.Dismiss();
                    isselected = true;
                };

                discard.Click += delegate
                {
                    popup.Dismiss();
                    isselected = true;
                };


                apply.Click += delegate
                {
                    currentSamplePage.OnApplyChanges(currentSamplePage.SampleView);

                    popup.Dismiss();
                    isselected = true;
                };
            };

            ActionBar.CustomView = mCustomView;
            SelectedGroup        = (Group)MainActivity.SelectedIntent.GetSerializableExtra("sample");

            TextView textView = (TextView)FindViewById(Resource.Id.title_text);

            textView.Text = SelectedGroup.Title;
            RelativeLayout textParent = (RelativeLayout)FindViewById(Resource.Id.textParent);

            textParent.Click += (object sender, EventArgs e) =>
            {
                OnBackButtonPressed();
            };

            if ((SelectedGroup as Group).Features.Count > 0)
            {
                this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
                AddTab("Types", new TypesFragment((SelectedGroup as Group).samples, this, false));

                AddTab("Features", new TypesFragment((SelectedGroup as Group).Features, this, true));
            }
            else
            {
                this.ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
                FrameLayout frameLayout = (FrameLayout)mainView.FindViewById(Resource.Id.fragment_content);
                sampleViewActivity = new SampleViewActivity((SelectedGroup as Group).samples, frameLayout, this, 0);
                if ((SelectedGroup as Group).samples.Count > 0)
                {
                    textView.Text = (SelectedGroup as Group).samples[0].Title;
                }
                sampleViewActivity.BaseTextView = textView;
            }

            if (savedInstanceState != null && ActionBar.TabCount > 0)
            {
                this.ActionBar.SelectTab(this.ActionBar.GetTabAt(savedInstanceState.GetInt("tab")));
            }
            base.OnCreate(savedInstanceState);
        }
Esempio n. 4
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowCustomEnabled(true);
            ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
            ActionBar.SetDisplayShowTitleEnabled(false);
            LayoutInflater mInflater      = LayoutInflater.From(this);
            View           mCustomView    = mInflater.Inflate(Resource.Layout.CustomActionBar, null);
            RelativeLayout imageButton    = (RelativeLayout)mCustomView.FindViewById(Resource.Id.imageButton);
            View           propertyWindow = mInflater.Inflate(Resource.Layout.Propertywindow, null);
            View           mainView       = mInflater.Inflate(Resource.Layout.layout, null);

            SettingsButton = imageButton;
            SetContentView(mainView);
            PopupWindow popup = new PopupWindow(propertyWindow, FrameLayout.LayoutParams.MatchParent,
                                                FrameLayout.LayoutParams.MatchParent);

            imageButton.Click += delegate
            {
                popup.ContentView = propertyWindow;
                View         propview = currentSamplePage.GetPropertyWindowLayout(this);
                LinearLayout linear   = (LinearLayout)propertyWindow.FindViewById(Resource.Id.container);
                linear.RemoveAllViews();
                linear.AddView(propview);
                if (isselected)
                {
                    popup.ShowAsDropDown(imageButton, 0, 280);
                    isselected = false;
                }


                ImageView iconclose = (ImageView)propertyWindow.FindViewById(Resource.Id.close);
                Button    discard   = (Button)propertyWindow.FindViewById(Resource.Id.discard);
                Button    apply     = (Button)propertyWindow.FindViewById(Resource.Id.apply);

                iconclose.Click += delegate
                {
                    popup.Dismiss();
                    isselected = true;
                };

                discard.Click += delegate
                {
                    popup.Dismiss();
                    isselected = true;
                };


                apply.Click += delegate
                {
                    currentSamplePage.OnApplyChanges(currentSamplePage.SampleView);
                    popup.Dismiss();
                    isselected = true;
                };
            };


            if (MainActivity.isFeatureSamples)
            {
                SelectedIndex = Int32.Parse(MainActivity.SelectedIntent.GetSerializableExtra("sample").ToString());
                Samples       = MainActivity.FeatureSamples;
            }
            else
            {
                SelectedIndex = FeaturesFragment.CurrentIndex;
                Samples       = FeaturesFragment.Samples;
            }

            ActionBar.CustomView = mCustomView;


            TextView textView = (TextView)FindViewById(Resource.Id.title_text);

            textView.Text = Samples[SelectedIndex].Title;
            RelativeLayout textParent = (RelativeLayout)FindViewById(Resource.Id.textParent);

            textParent.Click += (object sender, EventArgs e) =>
            {
                OnBackButtonPressed();
            };
            this.ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
            FrameLayout frameLayout = (FrameLayout)mainView.FindViewById(Resource.Id.fragment_content);

            sampleViewActivity = new SampleViewActivity(Samples, frameLayout, this, SelectedIndex);
            sampleViewActivity.BaseTextView = textView;

            base.OnCreate(savedInstanceState);
        }
		void RefreshSample(Sample selectedSample)
		{
			FrameLayout layout = (FrameLayout)FindViewById(Resource.Id.samplearea);
			layout.SetPadding (5, 5, 5, 5);
			layout.SetBackgroundColor (Color.White);
			selectedPageSample = selectedSample;
			ImageView settingsImage= (ImageView)FindViewById(Resource.Id.settings);
			if(propertyIndent!=null && propertyWindow!=null)
			{
				propertyWindow.Finish();
			}
			if (sample != null) {
				sample.Destroy();
			}
			propertyIndent = new Intent(this, typeof(PropertyWindow));
			TextView textView = (TextView) FindViewById(Resource.Id.title_text);
			textView.Text = selectedSample.Title;
			RelativeLayout settingButton = (RelativeLayout)FindViewById (Resource.Id.settingsParent);
			RelativeLayout textParent = (RelativeLayout)FindViewById (Resource.Id.textParent);
			textParent.Click+= (object sender, EventArgs e) => {

				OnBackButtonPressed();
			};
			bool isClassExists = Type.GetType("SampleBrowser."+selectedSample.Name)!=null;
			if (isClassExists) {
				var handle = Activator.CreateInstance (null, "SampleBrowser." + selectedSample.Name);
				sample = (SamplePage)handle.Unwrap ();
				layout.RemoveAllViews ();
				layout.AddView (sample.GetSampleContent (this));
				if (sample.GetPropertyWindowLayout (this) == null) {
					settingsImage.Visibility = ViewStates.Invisible;
					settingButton.Clickable = false;
				} else {
					settingsImage.Visibility = ViewStates.Visible;
					settingButton.Clickable = true;
				}
			}


		}