예제 #1
0
        void NavView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            var trans = SupportFragmentManager.BeginTransaction();

            switch (e.MenuItem.ItemId)
            {
            case Resource.Id.nav_single:
                e.MenuItem.SetChecked(true);
                trans.Replace(Resource.Id.fragmentContainer, new SingleTypeFragment(this));
                trans.Commit();
                break;

            case Resource.Id.nav_team:
                e.MenuItem.SetChecked(true);
                trans.Replace(Resource.Id.fragmentContainer, new TeamTypeFragment(this));
                trans.Commit();
                break;

            case Resource.Id.nav_language:
                ChangeLanguage();
                break;

            case Resource.Id.nav_help:
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                DialogHelp          dialog      = new DialogHelp();
                dialog.Show(transaction, "Help");
                break;
            }
            mDrawerLayout.CloseDrawers();
        }
예제 #2
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                mDrawerLayout.OpenDrawer((int)GravityFlags.Left);
                break;

            case Resource.Id.action_language:
                ChangeLanguage();

                //types = allTypes.defenseTypes;
                //Convert.ConvertInsideTypes(leftSide, rightSide);
                //Convert.ConvertTextViews(layouts);
                break;

            case Resource.Id.action_help:
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                DialogHelp          dialog      = new DialogHelp();
                dialog.Show(transaction, "Help");
                break;
            }

            return(base.OnOptionsItemSelected(item));
        }
예제 #3
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_language:
                SendData.isJapanese = !SendData.isJapanese;

                if (SendData.isJapanese)
                {
                    GetTypeLists.GetJapaneseLists(Assets);
                    SupportActionBar.Title = "防衛";
                    SaveController.GetSaveController().SetSavedLanguage("Japanese");
                }
                else
                {
                    GetTypeLists.GetEnglishLists(Assets);
                    SupportActionBar.Title = "Defense";
                    SaveController.GetSaveController().SetSavedLanguage("English");
                }

                types = allTypes.defenseTypes;
                Convert.ConvertInsideTypes(leftSide, rightSide);
                Convert.ConvertTextViews(layouts);
                break;

            case Resource.Id.action_help:
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                DialogHelp          dialog      = new DialogHelp();
                dialog.Show(transaction, "Help");
                break;
            }

            return(base.OnOptionsItemSelected(item));
        }
예제 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.main_layout);

            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            navView       = FindViewById <NavigationView>(Resource.Id.nav_view);
            var toolbar = this.FindViewById <SupportToolbar>(Resource.Id.toolbar);

            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, new SingleTypeFragment(this));
            trans.Commit();

            if (navView != null)
            {
                navView.NavigationItemSelected += NavView_NavigationItemSelected;
            }
            navView.Menu.GetItem(0).SetChecked(true);

            if (SendData.showHelp)
            {
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                DialogHelp          dialog      = new DialogHelp();
                dialog.Show(transaction, "Help");
            }

            SetSupportActionBar(toolbar);
            SupportActionBar ab = SupportActionBar;

            ab.SetHomeAsUpIndicator(Resource.Mipmap.ic_menu);
            ab.SetDisplayHomeAsUpEnabled(true);

            if (SendData.isJapanese)
            {
                for (int i = 0; i < navView.Menu.Size(); i++)
                {
                    navView.Menu.GetItem(i).SetTitle(Convert.LanguageDic[navView.Menu.GetItem(i).ToString()]);
                    if (i < 2)
                    {
                        navView.Menu.GetItem(2).SubMenu.GetItem(i).SetTitle(
                            Convert.LanguageDic[navView.Menu.GetItem(2).SubMenu.GetItem(i).ToString()]);
                    }
                }
            }
        }
예제 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            var toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout);
            layout1    = FindViewById <LinearLayout>(Resource.Id.layout1);
            layout2    = FindViewById <LinearLayout>(Resource.Id.layout2);
            layout3    = FindViewById <LinearLayout>(Resource.Id.layout3);
            layouts    = new List <LinearLayout> {
                layout1, layout2, layout3, mainLayout
            };
            left  = FindViewById <TextView>(Resource.Id.leftTop);
            right = FindViewById <TextView>(Resource.Id.rightTop);
            TextView textView1  = FindViewById <TextView>(Resource.Id.textView1);
            TextView textView2  = FindViewById <TextView>(Resource.Id.textView2);
            TextView textView3  = FindViewById <TextView>(Resource.Id.textView3);
            TextView textView4  = FindViewById <TextView>(Resource.Id.textView4);
            TextView textView5  = FindViewById <TextView>(Resource.Id.textView5);
            TextView textView6  = FindViewById <TextView>(Resource.Id.textView6);
            TextView textView7  = FindViewById <TextView>(Resource.Id.textView7);
            TextView textView8  = FindViewById <TextView>(Resource.Id.textView8);
            TextView textView9  = FindViewById <TextView>(Resource.Id.textView9);
            TextView textView10 = FindViewById <TextView>(Resource.Id.textView10);
            TextView textView11 = FindViewById <TextView>(Resource.Id.textView11);
            TextView textView12 = FindViewById <TextView>(Resource.Id.textView12);
            TextView textView13 = FindViewById <TextView>(Resource.Id.textView13);
            TextView textView14 = FindViewById <TextView>(Resource.Id.textView14);
            TextView textView15 = FindViewById <TextView>(Resource.Id.textView15);
            TextView textView16 = FindViewById <TextView>(Resource.Id.textView16);
            TextView textView17 = FindViewById <TextView>(Resource.Id.textView17);
            TextView textView18 = FindViewById <TextView>(Resource.Id.textView18);

            textViews = new List <TextView>
            {
                textView1, textView2, textView3, textView4, textView5, textView6, textView7, textView8, textView9, textView10,
                textView11, textView12, textView13, textView14, textView15, textView16, textView17, textView18
            };

            if (SendData.isJapanese)
            {
                Convert.ConvertTextViews(layouts);
                SupportActionBar.Title = "防衛";
            }
            else
            {
                SupportActionBar.Title = "Defense";
            }

            types = allTypes.defenseTypes;

            for (int i = 0; i < types.Count; i++)
            {
                textViews[i].Tag     = i;
                textViews[i].Text    = types[i].type;
                textViews[i].Gravity = GravityFlags.Center;
                textViews[i].SetPadding(0, 0, 0, 10);

                int h = Resources.DisplayMetrics.HeightPixels / 100;
                if (h > 18)
                {
                    h = 18;
                }

                textViews[i].SetTextSize(Android.Util.ComplexUnitType.Dip, h + 11);

                gradient = (GradientDrawable)textViews[i].Background;
                gradient.SetColor(Color.ParseColor(Colors.TypeToColor[types[i].type]));

                textViews[i].Click     += Handle_Click;
                textViews[i].LongClick += Handle_LongClick;
                //textViews[i].Touch += Handle_Touch;
            }

            if (SendData.showHelp)
            {
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                DialogHelp          dialog      = new DialogHelp();
                dialog.Show(transaction, "Help");
            }

            var adLayout = FindViewById <LinearLayout>(Resource.Id.googleAds);

            if (SendData.isConnected)
            {
                var ad = new AdView(this);
                ad.AdSize   = AdSize.SmartBanner;
                ad.AdUnitId = "ca-app-pub-2288808768882490/2788554960";
                var requestBuilder = new AdRequest.Builder();
                ad.LoadAd(requestBuilder.Build());
                adLayout.AddView(ad);
            }
            else
            {
                mainLayout.RemoveView(adLayout);
            }
        }