コード例 #1
0
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.activity_main);

        manager = FragmentManager;
        Fragment1 fragment = new Fragment1();

        manager.BeginTransaction().Add(Resource.Id.frameLayout1, fragment, "myfragmanetag").Commit();
        // t.Add(Resource.Id.fragment1,fragment);
        btn1        = FindViewById <Button>(Resource.Id.button1);
        edit        = FindViewById <EditText>(Resource.Id.editText1);
        btn1.Click += delegate
        {
            var text = edit.Text.ToString();
            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(this);
            ISharedPreferencesEditor editor = prefs.Edit();
            editor.PutString("Data", text);
            editor.Apply();
            //editor.Commit();
            Fragment frg = null;
            frg = manager.FindFragmentByTag("myfragmanetag");
            manager.BeginTransaction().Detach(frg).Attach(frg).Commit();
        };
    }
コード例 #2
0
        private void InviteCode_button_Click(object sender, EventArgs e)
        {
            Android.App.FragmentManager     manager     = this.Activity.FragmentManager;
            Android.App.FragmentTransaction transaction = manager.BeginTransaction();
            InviteCode_dialog inviteCode_dialog         = new InviteCode_dialog();

            inviteCode_dialog.Show(transaction, "dialog fragment");
        }
コード例 #3
0
 public AnimeDetailsPagerAdapter(FragmentManager fm) : base(fm)
 {
     _viewModel = ViewModelLocator.AnimeDetails;
 }
コード例 #4
0
 public AnimeDetailsPagerAdapter(FragmentManager fm) : base(fm)
 {
 }
コード例 #5
0
        public void OnClick(View v)
        {
            int id = v.Id;

            int titleId;
            int valueId;
            int itemsArrayId;
            int valuesArrayId;

            switch (id)
            {
            case PREF_SPACING_TYPE:
                titleId       = Resource.String.pref_spacing_type;
                valueId       = PREF_SPACING_TYPE_VALUE;
                itemsArrayId  = Resource.Array.spacing_types;
                valuesArrayId = Resource.Array.spacing_types_values;
                break;

            case PREF_SPACING_WIDTH:
                titleId       = Resource.String.pref_spacing_width;
                valueId       = PREF_SPACING_WIDTH_VALUE;
                itemsArrayId  = Resource.Array.width_strings;
                valuesArrayId = Resource.Array.width_values;
                break;

            case PREF_SPACING_ACTIONS_WIDTH:
                titleId       = Resource.String.pref_spacing_actions;
                valueId       = PREF_SPACING_ACTIONS_WIDTH_VALUE;
                itemsArrayId  = Resource.Array.width_strings;
                valuesArrayId = Resource.Array.width_values;
                break;

            case PREF_SHOW_SHADOW:
                CheckBox viewValue = v.FindViewById <CheckBox>(PREF_SHOW_SHADOW_VALUE);
                bool     @checked  = !viewValue.Checked;
                viewValue.Checked = @checked;
                if (mSettingsChangedListener != null)
                {
                    mSettingsChangedListener.OnSettingChanged(id, @checked ? 1 : 0);
                }
                else if (DEBUG)
                {
                    System.Console.WriteLine("OnSettingsChangedListener is not set");
                }
                return;

            case PREF_SHADOW_WIDTH:
                valueId       = PREF_SHADOW_WIDTH_VALUE;
                titleId       = Resource.String.pref_shadow_width;
                itemsArrayId  = Resource.Array.width_strings;
                valuesArrayId = Resource.Array.width_values;
                break;

            case PREF_FADE_TYPE:
                titleId       = Resource.String.pref_fade_type;
                valueId       = PREF_FADE_TYPE_VALUE;
                itemsArrayId  = Resource.Array.fade_types;
                valuesArrayId = Resource.Array.fade_types_values;
                break;

            case PREF_FADE_MAX_VALUE:
                titleId       = Resource.String.pref_fade_max_value;
                valueId       = PREF_FADE_MAX_VALUE_VALUE;
                itemsArrayId  = Resource.Array.fade_max_value_strings;
                valuesArrayId = Resource.Array.fade_max_value_values;
                break;

            case PREF_SWIPING_TYPE:
                titleId       = Resource.String.pref_swiping_type;
                valueId       = PREF_SWIPING_TYPE_VALUE;
                itemsArrayId  = Resource.Array.swiping_types;
                valuesArrayId = Resource.Array.swiping_types_values;
                break;

            case PREF_SWIPING_EDGE_WIDTH:
                valueId       = PREF_SWIPING_EDGE_WIDTH_VALUE;
                titleId       = Resource.String.pref_swiping_edge_width;
                itemsArrayId  = Resource.Array.width_strings;
                valuesArrayId = Resource.Array.width_values;
                break;

            case PREF_FLING_DURATION:
                titleId       = Resource.String.pref_other_fling_duration;
                valueId       = PREF_FLING_DURATION_VALUE;
                itemsArrayId  = Resource.Array.fling_duration_strings;
                valuesArrayId = Resource.Array.fling_duration_values;
                break;

            default:
                return;
            }

            Fragment prev = FragmentManager.FindFragmentByTag(ValueChooserDialogFragment.TAG);

            if (prev != null)
            {
                FragmentManager.BeginTransaction().Remove(prev).Commit();
            }

            ValueChooserDialogFragment fragment = ValueChooserDialogFragment.NewInstance(id, titleId, itemsArrayId);

            fragment.OnSettingsSelectedListener = new MyOnSettingSelectedListener(this, v, id, valueId, valuesArrayId);
            fragment.Show(FragmentManager, ValueChooserDialogFragment.TAG);
        }
コード例 #6
0
 public MyFragmentPagerAdapter(Android.App.FragmentManager fm)
     : base(fm)
 {
     fgls.Add(KnowledgesLanguageFragment.NewInstance());
     fgls.Add(KnowledgesToolFragment.NewInstance());
 }
コード例 #7
0
 public CalculatorGridPagerAdapter(Context ctx, Android.App.FragmentManager gm) : base(gm)
 {
     this.calculatorFragment = new CalculatorFragment();
 }