示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            mSettingsChangedListener = new SettingsChangedListener(this);

            SetContentView(Resource.Layout.example);

            viewActionsContentView             = FindViewById <ActionsContentView>(Resource.Id.actionsContentView);
            viewActionsContentView.SwipingType = ActionsContentView.SWIPING_EDGE;

            ListView       viewActionsList = FindViewById <ListView>(Resource.Id.actions);
            ActionsAdapter actionsAdapter  = new ActionsAdapter(this);

            viewActionsList.Adapter    = actionsAdapter;
            viewActionsList.ItemClick += viewActionsList_ItemClick;

            ImageButton mainButton = FindViewById <ImageButton>(Resource.Id.mainButton);

            mainButton.Click += mainButton_Click;

            Button sourceCodeButton = FindViewById <Button>(Resource.Id.sourceCodeButton);

            sourceCodeButton.Click += sourceCodeButton_Click;

            if (savedInstanceState != null)
            {
                CurrentUri = Uri.Parse(savedInstanceState.GetString(STATE_URI));
                CurrentContentFragmentTag = savedInstanceState.GetString(STATE_FRAGMENT_TAG);
            }

            UpdateContent(CurrentUri);
        }
        private void Init(int position)
        {
            int layoutId = mAdapter.GetItemAtPosition(position);

            SetContentView(layoutId);

            string   titleText = GetString(Resource.String.action_effects);
            TextView title     = FindViewById <TextView>(Android.Resource.Id.Text1);

            title.Text = titleText.ToUpper();

            ActionsContentView viewActionsContentView = FindViewById <ActionsContentView>(Resource.Id.actionsContentView);

            // The Android way
            //viewActionsContentView.OnActionsContentListener = new MyOnActionsContentListener();

            // OR
            // I ADDED THIS
            // The .NET way
            viewActionsContentView.ContentStateChanged += viewActionsContentView_ContentStateChanged;

            TextView name = FindViewById <TextView>(Resource.Id.effect_name);

            name.Text = mAdapter.GetEffectTitle(position);

            TextView actions     = FindViewById <TextView>(Resource.Id.actions_html);
            string   actionsHtml = mAdapter.GetActionsHtml(position);

            if (!TextUtils.IsEmpty(actionsHtml))
            {
                FindViewById(Resource.Id.effect_actions_layout).Visibility = ViewStates.Visible;
                actions.Text = Html.FromHtml(actionsHtml).ToString();
            }

            TextView content     = FindViewById <TextView>(Resource.Id.content_html);
            string   contentHtml = mAdapter.GetContentHtml(position);

            if (!TextUtils.IsEmpty(contentHtml))
            {
                FindViewById(Resource.Id.effect_content_layout).Visibility = ViewStates.Visible;
                content.Text = Html.FromHtml(contentHtml).ToString();
            }

            viewList            = FindViewById <ListView>(Resource.Id.actions);
            viewList.Adapter    = mAdapter;
            viewList.ItemClick += (sender, e) =>
            {
                Init(e.Position);
            };
        }
        private void Init(int position)
        {
            int layoutId = MAdapter.GetItemAtPosition(position);

            SetContentView(layoutId);

            string   titleText = GetString(Resource.String.action_effects);
            TextView title     = FindViewById <TextView>(Android.Resource.Id.Text1);

            title.Text = titleText.ToUpper();

            ActionsContentView viewActionsContentView = FindViewById <ActionsContentView>(Resource.Id.actionsContentView);

            viewActionsContentView.OnActionsContentListener = new ActionsContentListener(this);

            TextView name = FindViewById <TextView>(Resource.Id.effect_name);

            name.Text = MAdapter.GetEffectTitle(position);

            TextView actions     = FindViewById <TextView>(Resource.Id.actions_html);
            string   actionsHtml = MAdapter.GetActionsHtml(position);

            if (!TextUtils.IsEmpty(actionsHtml))
            {
                FindViewById(Resource.Id.effect_actions_layout).Visibility = ViewStates.Visible;
                actions.Text = Html.FromHtml(actionsHtml).ToString();
            }

            TextView content     = FindViewById <TextView>(Resource.Id.content_html);
            string   contentHtml = MAdapter.GetContentHtml(position);

            if (!TextUtils.IsEmpty(contentHtml))
            {
                FindViewById(Resource.Id.effect_content_layout).Visibility = ViewStates.Visible;
                content.Text = Html.FromHtml(contentHtml).ToString();
            }

            ViewList                     = FindViewById <ListView>(Resource.Id.actions);
            ViewList.Adapter             = MAdapter;
            ViewList.OnItemClickListener = new ListViewItemClickListener(this, position);
        }
 public void OnContentStateChanged(ActionsContentView v, bool isContentShown)
 {
     //v.ContentController.IgnoreTouchEvents = !isContentShown;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            mSettingsChangedListener = new SettingsChangedListener(this);

            SetContentView(Resource.Layout.example);

            viewActionsContentView = FindViewById<ActionsContentView>(Resource.Id.actionsContentView);
            viewActionsContentView.SwipingType = ActionsContentView.SwipingEdge;

            ListView viewActionsList = FindViewById<ListView>(Resource.Id.actions);
            ActionsAdapter actionsAdapter = new ActionsAdapter(this);
            viewActionsList.Adapter = actionsAdapter;
            viewActionsList.OnItemClickListener = new ActionsItemClickListener(this, actionsAdapter);

            ImageButton mainButton = FindViewById<ImageButton>(Resource.Id.mainButton);
            mainButton.Click += OnActionsButtonClick;

            Button sourceCodeButton = FindViewById<Button>(Resource.Id.sourceCodeButton);
            sourceCodeButton.Click += OnSourceCodeClick;

            if (savedInstanceState != null)
            {
                CurrentUri = Uri.Parse(savedInstanceState.GetString(STATE_URI));
                CurrentContentFragmentTag = savedInstanceState.GetString(STATE_FRAGMENT_TAG);
            }

            UpdateContent(CurrentUri);
        }
 public void OnContentStateChanged(ActionsContentView v, bool isContentShown)
 {
     //v.ContentController.IgnoreTouchEvents = !isContentShown;
 }
 public void OnContentStateInAction(ActionsContentView v, bool isContentShowing)
 {
 }
 public void OnContentStateChanged(ActionsContentView v, bool isContentShown)
 {
     Console.WriteLine("ContentStateChanged");
     v.ContentController.IgnoreTouchEvents = !isContentShown;
 }
 void viewActionsContentView_ContentStateChanged(ActionsContentView view, bool isContentShown)
 {
     Console.WriteLine(".NET -> ContentStateChanged");
     view.ContentController.IgnoreTouchEvents = !isContentShown;
 }