protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set Projects View in layout folder as Content view for "ProjectsActivity.cs". -E154 T4.30
            SetContentView(Resource.Layout.Projects);

            //Get the Toolbar id from the resources. -E157 T4.00
            projectToolbar          = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.projectsToolbar);
            projectBottomNavigation = FindViewById <Android.Support.Design.Widget.BottomNavigationView>(Resource.Id.projectbottom_navigation);

            //Get tabs Id and create Tab selected event to change conent. -E155 T10.30
            tabLayout              = FindViewById <TabLayout>(Resource.Id.projectTabLayout);
            tabLayout.TabSelected += TabLayout_TabSelected;

            //Create clicked event on the toolbar. -E157 T9.00
            projectToolbar.InflateMenu(Resource.Menu.projectsMenu);
            projectToolbar.MenuItemClick += ProjectToolbar_MenuItemClick;

            //Bind the Bottom Navigatoin Menu page with the Project UI
            projectBottomNavigation.InflateMenu(Resource.Menu.projectBottomNavigation);

            //Default display Active Fragement when activity is displayed. -E155 T12.20
            FragmentNavigate(new ActiveFragment());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Details);

            //
            // Retrieve the recipe to be displayed on this page
            //
            int index = Intent.GetIntExtra("RecipeIndex", -1);

            recipe = RecipeData.Recipes[index];

            toolbar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.Title = recipe.Name;
            toolbar.InflateMenu(Resource.Menu.actions);
            toolbar.MenuItemClick += OnMenuItemClick;

            //
            // Show the list of ingredients
            //
            var list = FindViewById <ListView>(Resource.Id.ingredientsListView);

            list.Adapter = adapter = new ArrayAdapter <Ingredient>(this, Android.Resource.Layout.SimpleListItem1, recipe.Ingredients);

            SetFavoriteDrawable(recipe.IsFavorite);

            //
            // Navigation button: navigate back to the previous page
            //
            FindViewById <ImageButton>(Resource.Id.backButton).Click += (sender, e) => Finish();
        }
Esempio n. 3
0
        protected virtual void InitializeToolbar()
        {
            toolbar = this.FindViewById <Toolbar>(Resource.Id.toolbar);

            if (toolbar == null)
            {
                throw new Exception("Layout is required to include a Toolbar with id Toolbar");
            }
            toolbar.InflateMenu(Resource.Menu.main);
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            this.SetSupportActionBar(toolbar);
            toolBarInitialized = true;

            if (drawerLayout == null)
            {
                return;
            }

            var navView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (navView == null)
            {
                throw new Exception("A layout with a drawerLAyout is required to include a ListView with id 'drawerList'");
            }

            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_content_drawer, Resource.String.close_content_drawer);
            drawerLayout.SetDrawerListener(this);
            //drawerLayout.SetStatusBarBackgroundColor(ResourceHelper.);
            populateDrawerItems(navView);
            UpdateDrawerToggle();
        }
Esempio n. 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            //Get the Toolbar id from the resources. -E157 T4.00
            projectToolbar          = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.projectsToolbar);
            futureEditText          = FindViewById <EditText>(Resource.Id.futureEditText);
            floatingActionButton    = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.addActionButton);
            projectBottomNavigation = FindViewById <Android.Support.Design.Widget.BottomNavigationView>(Resource.Id.projectbottom_navigation);
            listView = FindViewById <ListView>(Resource.Id.futureListView);

            //Bind the Bottom Navigatoin Menu page with the Project UI
            projectBottomNavigation.InflateMenu(Resource.Menu.projectBottomNavigation);
            //Create clicked event on the toolbar. -E157 T9.00
            projectToolbar.InflateMenu(Resource.Menu.projectsMenu);

            //Create clicked event on the toolbar. -E157 T9.00
            projectToolbar.MenuItemClick += ProjectToolbar_MenuItemClick;
            floatingActionButton.Click   += FloatingActionButton_Click;

            //Taking the database values and displaying that on the screen
            var lstSource = pdb.stringListViewProjects();
            var adapter   = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, lstSource);

            listView.SetAdapter(adapter);
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            FrameLayout ProfileLayout = new FrameLayout(this);

            SetContentView(ProfileLayout);
            base.CombineWith(ProfileLayout, Resource.Layout.Profile, ActivityIs.Profile);

            MainToolbar = FindViewById <SupportToolBar>(Resource.Id.toolbar);
            EditName    = FindViewById <EditText>(Resource.Id.EditProfileUserName);
            SwitchState = FindViewById <TextView>(Resource.Id.SwitchStateText);

            NotificationSwitch = FindViewById <Switch>(Resource.Id.SwitchEmailNotifications);
            UserAvatar         = FindViewById <CircularImageView>(Resource.Id.UserAvatar);
            UserName           = FindViewById <TextView>(Resource.Id.ProfileUserName);
            UserEmail          = FindViewById <TextView>(Resource.Id.ProfileUserEmail);

            InitializeProfile();

            MainToolbar.InflateMenu(Resource.Menu.profile_top_menu);
            MainToolbar.Title = "Profile";

            NotificationSwitch.Visibility = ViewStates.Invisible;
            EditName.Visibility           = ViewStates.Invisible;
            SetSwitchState();

            MainToolbar.MenuItemClick += MainToolbar_MenuItemClick;
            UserAvatar.Click          += UserAvatar_Click;
        }
Esempio n. 6
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.Detalle);
     toolbarR       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbarR);
     toolbarR.Title = "Nombre de la receta";
     toolbarR.InflateMenu(Resource.Menu.opciones);
     toolbarR.MenuItemClick += Toolbar_MenuItemClick;
     FindViewById <ImageButton>(Resource.Id.regresar).Click += (sender, e) => Finish();
 }
Esempio n. 7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FrameLayout MainLayout = new FrameLayout(this);

            SetContentView(MainLayout);
            base.CombineWith(MainLayout, Resource.Layout.Main, ActivityIs.Home);

            MainToolbar     = FindViewById <SupportToolBar>(Resource.Id.toolbar);
            SayThanksButton = FindViewById <Button>(Resource.Id.thanksButton);
            UserAvatar      = FindViewById <CircularImageView>(Resource.Id.UserAvatar);
            UserName        = FindViewById <TextView>(Resource.Id.UserName);
            UserEmail       = FindViewById <TextView>(Resource.Id.UserEmail);
            Balance         = FindViewById <TextView>(Resource.Id.ABpoints);
            Rewards         = FindViewById <TextView>(Resource.Id.Rpoints);
            Distribute      = FindViewById <TextView>(Resource.Id.CDpoints);
            RefreshInfo     = FindViewById <SwipeRefreshLayout>(Resource.Id.activity_main_swipe_refresh_layout);

            ABPointstext = FindViewById <TextView>(Resource.Id.ABpointsText);
            RPointstext  = FindViewById <TextView>(Resource.Id.RpointsText);
            CDPointstext = FindViewById <TextView>(Resource.Id.CDpointsText);

            ISharedPreferences info = Application.Context.GetSharedPreferences(GetString(Resource.String.ApplicationInfo), FileCreationMode.Private);

            Loggedin = info.GetBoolean(GetString(Resource.String.LogIn), false);

            if (!Loggedin)
            {
                Intent LogInIntent = new Intent(this, typeof(LogInActivity));
                LogInIntent.AddFlags(ActivityFlags.NoAnimation);
                this.StartActivityForResult(LogInIntent, LOG_IN_REQUEST);
                OverridePendingTransition(0, 0);
            }
            else
            {
                InitializeProfile();
            }

            CorrectPointsText();

            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                SayThanksButton.SetBackgroundResource(Resource.Color.button_ripple);
            }

            MainToolbar.InflateMenu(Resource.Menu.top_menu);
            MainToolbar.SetLogo(Resource.Drawable.ic_cloud_queue_white_24dp);
            MainToolbar.Title            = "Merit Money";
            MainToolbar.TitleMarginStart = AdditionalFunctions.ConvertDpToPx(40);

            SayThanksButton.Click     += SayThanksButton_Click;
            MainToolbar.MenuItemClick += MainToolbar_MenuItemClick;
            RefreshInfo.Refresh       += Profile_Refresh;
        }
Esempio n. 8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            String[] SplitSearchRequest(String request)
            {
                request = Regex.Replace(request, @"\t|\r|\n", String.Empty);
                return(request.Split(',').Select(r => r.Trim()).Where(r => r != String.Empty).ToArray());
            }

            base.OnCreate(savedInstanceState);

            _application = ApplicationContext as ScheduleApplication;

            SetTheme(_application.Preferences.UseDarkTheme ? Resource.Style.Theme_SmtuSchedule_Dark
                : Resource.Style.Theme_SmtuSchedule_Light);

            SetContentView(Resource.Layout.downloadActivity);

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.downloadActivityToolbar);

            toolbar.NavigationClick += (s, e) => OnBackPressed();

            toolbar.InflateMenu(Resource.Menu.downloadMenu);
            toolbar.MenuItemClick += (s, e) =>
            {
                Intent intent = new Intent();
                intent.PutExtra(IntentSearchRequestsKey, SplitSearchRequest(_searchRequestTextView.Text));

                SetResult(Result.Ok, intent);
                Finish();
            };

            _searchRequestTextView = FindViewById <MultiAutoCompleteTextView>(
                Resource.Id.downloadMultiAutoCompleteTextView
                );

            if (_searchRequestTextView.RequestFocus())
            {
                Window.SetSoftInputMode(SoftInput.StateAlwaysVisible);
            }

            IMenuItem downloadMenuItem = toolbar.Menu.GetItem(0);

            downloadMenuItem.SetEnabled(false);

            _searchRequestTextView.SetTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
            _searchRequestTextView.TextChanged += (s, e) =>
            {
                Boolean isUserInputValid = !String.IsNullOrWhiteSpace(_searchRequestTextView.Text);
                downloadMenuItem.SetEnabled(isUserInputValid);
            };

            DownloadLecturersAsync();
        }
Esempio n. 9
0
 public override bool OnCreateOptionsMenu(IMenu menu)
 {
     toolbar.InflateMenu(Resource.Menu.toolbar_menu);
     toolbar.MenuItemClick += (sender, e) =>
     {
         if (notificationManager != null)
         {
             notificationManager.CancelAll();
         }
         MediaService.StopMediaPlayer();
     };
     return(base.OnPrepareOptionsMenu(menu));
 }
        private void FindViews()
        {
            ListViewHome = FindViewById <ListView>(Resource.Id.listviewHome);

            toolbar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.Title = "W/Vendas";
            toolbar.InflateMenu(Resource.Menu.menu_toolbar);

            toolbar.Menu.RemoveItem(Resource.Id.action_deletar);
            toolbar.Menu.RemoveItem(Resource.Id.action_adicionar);
            toolbar.Menu.RemoveItem(Resource.Id.action_salvar);
            toolbar.Menu.RemoveItem(Resource.Id.action_filtrar);
            toolbar.Menu.RemoveItem(Resource.Id.action_legenda);
        }
Esempio n. 11
0
        private void HandleHomeButton()
        {
            if (actionBarDrawerToggle.DrawerIndicatorEnabled)
            {
                drawerLayout.OpenDrawer(Android.Support.V4.View.GravityCompat.Start);
                return;
            }

            actionBarDrawerToggle.DrawerIndicatorEnabled = true;

            if (FragmentManager.BackStackEntryCount >= 1)
            {
                FragmentManager.PopBackStackImmediate();
                mainToolBar.Menu.RemoveItem(Resource.Id.menu_card_view);
                mainToolBar.Menu.RemoveItem(Resource.Id.menu_grid_view);
                mainToolBar.Menu.Clear();
                mainToolBar.InflateMenu(Resource.Menu.MainToolBarMenu);

                ShowHamurgerIcon();
                SupportActionBar.Title = Resources.GetString(Resource.String.app_name);

                floatingAddButton.Visibility = ViewStates.Visible;
            }
            else if (SupportFragmentManager.BackStackEntryCount >= 1)
            {
                SupportFragmentManager.PopBackStackImmediate();
                mainToolBar.Menu.RemoveItem(Resource.Id.menu_card_view);
                mainToolBar.Menu.RemoveItem(Resource.Id.menu_grid_view);
                mainToolBar.Menu.Clear();
                mainToolBar.InflateMenu(Resource.Menu.MainToolBarMenu);

                ShowHamurgerIcon();
                SupportActionBar.Title = Resources.GetString(Resource.String.app_name);

                floatingAddButton.Visibility = ViewStates.Visible;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.Tabs);
            tabsToolbar            = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.tabsToolbar);
            tabLayout              = FindViewById <TabLayout>(Resource.Id.mainTabLayout);
            tabLayout.TabSelected += TabLayout_TabSelected;

            tabsToolbar.InflateMenu(Resource.Menu.tabsMenu);
            tabsToolbar.MenuItemClick += TabsToolbar_MenuItemClick;

            FragmentNavigate(new DeliveriesFragment());
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);
            toolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.toolBar);
            toolbar.SetTitle(Resource.String.app_name);
            toolbar.SetBackgroundColor(Android.Graphics.Color.LightBlue);
            toolbar.InflateMenu(Resource.Menu.optionMenu);
            toolbar.MenuItemClick += Toolbar_MenuItemClick;

            FragmentNavigate(new ItenFragment());

            cartButton = (Button)FindViewById(Resource.Id.cartButton);

            cartButton.Click += CartButton_Click;
        }
Esempio n. 14
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.TEditorActivity);

            _topToolBar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.TopToolbar);
            _topToolBar.Title = CrossTEditor.PageTitle;
            _topToolBar.InflateMenu(Resource.Menu.TopToolbarMenu);
            _topToolBar.MenuItemClick += async(sender, e) =>
            {
                if (SetOutput != null)
                {
                    if (e.Item.TitleFormatted.ToString() == "Save")
                    {
                        var html = await _editorWebView.GetHTML();

                        SetOutput.Invoke(true, html);
                    }
                    else
                    {
                        SetOutput.Invoke(false, null);
                    }
                }

                Finish();
            };

            _rootLayout    = FindViewById <LinearLayoutDetectsSoftKeyboard>(Resource.Id.RootRelativeLayout);
            _editorWebView = FindViewById <TEditorWebView>(Resource.Id.EditorWebView);
            _toolbarLayout = FindViewById <LinearLayout>(Resource.Id.ToolbarLayout);

            _rootLayout.onKeyboardShown += HandleSoftKeyboardShwon;
            _editorWebView.SetOnCreateContextMenuListener(this);

            BuildToolbar();

            var htmlString = Intent.GetStringExtra("HTMLString") ?? "<p></p>";

            _editorWebView.SetHTML(htmlString);

            var autoFocusInput = Intent.GetBooleanExtra("AutoFocusInput", false);

            _editorWebView.SetAutoFocusInput(autoFocusInput);
        }
Esempio n. 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Activity_Menu);

            transportador.core.DAL.Database.Inicializar();

            FindViews();
            BindData();
            FillList(dataEmissao);

            toolbar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.Title = " W/Transportador Express";
            toolbar.InflateMenu(Resource.Menu.menu_toolbar);
            toolbar.Menu.RemoveItem(Resource.Id.action_deletar);

            toolbar.MenuItemClick += Toolbar_MenuItemClick;
        }
        Android.Support.V7.Widget.Toolbar tabsToolbar;      // otherwise from Android.Widget.Toolbar by default - would be different types

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            // ok! :-) This activity will be to do with our Tabs layout (ie the new main page)
            SetContentView(Resource.Layout.Tabs);

            tabsToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.tabsToolbar); // use the id defined in the element in Tabs.axml

            tabLayout              = this.FindViewById <TabLayout>(Resource.Id.mainTabLayout);       // get our tab by id defined as android:id="@+id/mainTabLayout"
            tabLayout.TabSelected += TabLayout_TabSelected;                                          // += then TAB for auto-complete of event handler

            tabsToolbar.InflateMenu(Resource.Menu.tabsMenu);                                         // use resource defined
            tabsToolbar.MenuItemClick += TabsToolbar_MenuItemClick;                                  // += and TAB to subscribe with handler method

            FragmentNavigate(new DeliveriesFragment());                                              // in effect, make Deliveries the default fragment on startup
        }
Esempio n. 17
0
        private void InitializeComponent(string htmlStringvalue, bool autoFocusInputvalue)
        {
            _topToolBar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.TopToolbar);
            _topToolBar.Title = CrossTEditor.PageTitle;
            _topToolBar.SetNavigationIcon(Resource.Drawable.backbutton);
            _topToolBar.SetTitleTextColor(Android.Graphics.Color.White);
            _topToolBar.SetOnClickListener(new BackClicked(DecoreView, this));
            _topToolBar.InflateMenu(Resource.Menu.TopToolbarMenu);
            _topToolBar.MenuItemClick += async(sender, e) =>
            {
                if (SetOutput != null)
                {
                    if (e.Item.TitleFormatted.ToString() == "Save")
                    {
                        string html = await _editorWebView.GetHTML();

                        SetOutput.Invoke(true, html);
                    }
                    else
                    {
                        SetOutput.Invoke(false, null);
                    }
                }

                DecoreView.RemoveView(this);
            };

            _rootLayout    = FindViewById <LinearLayoutDetectsSoftKeyboard>(Resource.Id.RootRelativeLayout);
            _editorWebView = FindViewById <TEditorWebView>(Resource.Id.EditorWebView);
            _toolbarLayout = FindViewById <LinearLayout>(Resource.Id.ToolbarLayout);

            _rootLayout.onKeyboardShown += HandleSoftKeyboardShwon;
            _editorWebView.SetOnCreateContextMenuListener(this);
            BuildToolbar();

            string htmlString = htmlStringvalue;

            _editorWebView.SetHTML(htmlString);

            bool autoFocusInput = autoFocusInputvalue;

            _editorWebView.SetAutoFocusInput(autoFocusInput);
        }
Esempio n. 18
0
        private void nativeListView_OnItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            uiListView.RaiseItemLongPressEvent(e.Position - 1);
            return;

            if (!IsSelectedMode())
            {
                // Code to execute on item long click
                //uiListView.RaiseItemLongPressEvent();
                uiListView.MarkItemAsSelected(e.Position - 1);

                mainToolbar = mainActivity.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
                mainToolbar.SetBackgroundColor(Android.Graphics.Color.DarkGray);
                mainToolbar.InflateMenu(Resource.Menu.NotificationMenu);
                mainToolbar.SetNavigationOnClickListener(new OnNavigationClickToolbar(mainActivity));
                mainToolbar.MenuItemClick += Toolbar_MenuItemClick;
                //mainToolbar.NavigationClick += MainToolbar_NavigationClick;
                mainToolbar.Title = $"{uiListView.ItemsSelectedCount()} seleccionado";
            }
        }
        private void FindViews()
        {
            edtServidor = FindViewById <EditText>(Resource.Id.edtServidor);
            edtUsuario  = FindViewById <EditText>(Resource.Id.edtUsuario);
            edtSenha    = FindViewById <EditText>(Resource.Id.edtSenha);
            btnEntrar   = FindViewById <Button>(Resource.Id.btnEntrar);
            lblmensagem = FindViewById <TextView>(Resource.Id.txtMensagem);

            toolbar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.Title = "W/Venda";
            toolbar.InflateMenu(Resource.Menu.menu_toolbar);
            toolbar.Menu.RemoveItem(Resource.Id.action_refresh);
            toolbar.Menu.RemoveItem(Resource.Id.action_help);
            toolbar.Menu.RemoveItem(Resource.Id.action_sobre);
            toolbar.Menu.RemoveItem(Resource.Id.action_salvar);
            toolbar.Menu.RemoveItem(Resource.Id.action_deletar);
            toolbar.Menu.RemoveItem(Resource.Id.action_adicionar);
            toolbar.Menu.RemoveItem(Resource.Id.action_legenda);
            toolbar.Menu.RemoveItem(Resource.Id.action_contato);

            toolbar.MenuItemClick += Toolbar_MenuItemClick;
        }
Esempio n. 20
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view              = inflater.Inflate(Resource.Layout.work_path_fragment, container, false);
            workPathLayout    = view.FindViewById <LinearLayout>(Resource.Id.work_path_layout);
            coordinatorLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.coordinator_layout);

            string workPath = Pref.WorkPath;

            workPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.work_path_fragment);
            workPathFragment.RefreshFilesList(workPath);
            workPathFragment.SnackbarView = coordinatorLayout;
            //workPathFragment.PrefKey = Pref.WorkPathKey;

            etWorkPath              = view.FindViewById <EditText>(Resource.Id.etWorkPath);
            etWorkPath.Text         = workPath;
            etWorkPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
            {
                try {
                    var dir = new DirectoryInfo(etWorkPath.Text);
                    if (dir.IsDirectory())
                    {
                        Pref.WorkPath = etWorkPath.Text;
                    }
                    else
                    {
                        Show("잘못된 경로: " + etWorkPath.Text);
                        etWorkPath.Text = Pref.WorkPath;
                    }
                } catch {
                    Show("잘못된 경로: " + etWorkPath.Text);
                    etWorkPath.Text = Pref.WorkPath;
                }
                workPathFragment.RefreshFilesList(etWorkPath.Text);
            };
            etWorkPath.KeyPress += (object sender, View.KeyEventArgs e) =>
            {
                e.Handled = false;
                if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape)
                {
                    var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
                    imm.HideSoftInputFromWindow(etWorkPath.WindowToken, 0);
                    etWorkPath.ClearFocus();
                    e.Handled = true;
                }
            };

            workPathToolbar = view.FindViewById <Toolbar>(Resource.Id.work_path_toolbar);
            workPathToolbar.InflateMenu(Resource.Menu.toolbar_work_path_menu);
            workPathToolbar.MenuItemClick += (sender, e) =>
            {
                //Toast.MakeText(this, "Bottom toolbar pressed: " + e.Item.TitleFormatted, ToastLength.Short).Show();
                bool ret;
                switch (e.Item.ItemId)
                {
                case Resource.Id.toolbar_work_path_menu_up:
                    OnBackPressedFragment();
                    break;

                case Resource.Id.toolbar_work_path_menu_home:
                    if (!Refresh(Pref.WorkPath))
                    {
                        Show("경로 이동 실패: " + Pref.WorkPath);
                    }
                    break;

                case Resource.Id.toolbar_work_path_menu_storage:
                    if (!Refresh("/storage"))
                    {
                        Show("경로 이동 실패: " + "/storage");
                    }
                    break;

                case Resource.Id.toolbar_work_path_menu_sdcard:
                    if (!Refresh(Environment.ExternalStorageDirectory.AbsolutePath))
                    {
                        Show("경로 이동 실패: " + Environment.ExternalStorageDirectory.AbsolutePath);
                    }
                    break;

                case Resource.Id.toolbar_work_path_menu_extsdcard:
                    ret = false;
                    try {
                        var dir = new DirectoryInfo("/storage");
                        foreach (var item in dir.GetDirectories())
                        {
                            if (item.Name.ToLower().StartsWith("ext") || item.Name.ToLower().StartsWith("sdcard1"))
                            {
                                foreach (var subItem in item.GetFileSystemInfos())
                                {
                                    if (Refresh(item.FullName))
                                    {
                                        ret = true;
                                        break;
                                    }
                                }
                            }
                        }
                    } catch { }
                    if (!ret)
                    {
                        Show("경로 이동 실패: " + "SD 카드");
                    }
                    break;

                case Resource.Id.toolbar_work_path_menu_usbstorage:
                    ret = false;
                    try {
                        var dir = new DirectoryInfo("/storage");
                        foreach (var item in dir.GetDirectories())
                        {
                            if (item.Name.ToLower().StartsWith("usb"))
                            {
                                foreach (var subItem in item.GetFileSystemInfos())
                                {
                                    if (Refresh(item.FullName))
                                    {
                                        ret = true;
                                        break;
                                    }
                                }
                            }
                        }
                    } catch { }
                    if (!ret)
                    {
                        Show("경로 이동 실패: " + "USB 저장소");
                    }
                    break;
                }
            };

            fab        = view.FindViewById <FloatingActionButton>(Resource.Id.fab);
            fab.Click += (sender, e) =>
            {
                etWorkPath.Text = workPathFragment.DirPath;
                Pref.WorkPath   = etWorkPath.Text;
                workPathFragment.RefreshFilesList();
                Show("경로 설정 완료: " + etWorkPath.Text);
            };

            return(view);
        }
Esempio n. 21
0
        // int SHOT_TYPE;

        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.screenshot_activity);
            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);       
            SetSupportActionBar(mToolbar);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.Title = GetString(Resource.String.action_screenshot);
            iView = FindViewById<ImageView>(Resource.Id.ivScreenShot);
            iView.Click += (sender, e) =>
            {
               
                var content = GetBytesFromDrawable(iView.Drawable);

                //make sure we have something to show in the first place
                if (content != null && iView.Drawable != defaultImage)
                {
                        
                    //there is no external storage available, Gallery cannot show internal cache image
                    if (FileSystem.GetTmpDir(this) == CacheDir.AbsolutePath)
                        return;
                       
                    try
                    {
                        if (SaveFile(GetTmpFileName(), content))
                        {
                            Intent intent = new Intent();
                            intent.SetAction(Intent.ActionView);
                            intent.SetDataAndType(Android.Net.Uri.Parse("file://" + GetTmpFileName()), "image/*");
                            StartActivity(intent);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(TAG, string.Format("Error launching image view intent! {0}", ex.Message));
                    }
                }
            };
            pbScreenShot = FindViewById<ProgressBar>(Resource.Id.pbScreenShot);
            defaultImage = iView.Drawable;
            layoutPb = FindViewById<LinearLayout>(Resource.Id.layoutPb);
            bottomToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_bottom);
            bottomToolbar.InflateMenu(Resource.Menu.menu_screenshot);
            screenshotAll = bottomToolbar.Menu.FindItem(Resource.Id.action_screenshot_all);
            screenshotOSD = bottomToolbar.Menu.FindItem(Resource.Id.action_screenshot_osd);
            screenshotPicture = bottomToolbar.Menu.FindItem(Resource.Id.action_screenshot_picture);
            saveMenu = bottomToolbar.Menu.FindItem(Resource.Id.action_save);
            saveMenu.SetVisible(FileSystem.IsExternalStorageWritable());
            bottomToolbar.MenuItemClick += (sender, e) =>
            {
                if (e.Item.ItemId == Resource.Id.action_screenshot_all)
                {
                    TakeScreenshot(ScreenshotType.All);
                    e.Handled = true;
                }
                else if (e.Item.ItemId == Resource.Id.action_screenshot_osd)
                {
                    TakeScreenshot(ScreenshotType.Osd);
                    e.Handled = true;
                }
                else if (e.Item.ItemId == Resource.Id.action_screenshot_picture)
                {
                    TakeScreenshot(ScreenshotType.Picture);
                    e.Handled = true;
                }
                else if (e.Item.ItemId == Resource.Id.action_save)
                {
                    SaveToDisk();
                    e.Handled = true;
                }
            };
            //bundle = this.Intent.Extras;
            //SHOT_TYPE = bundle.GetInt("SHOT_TYPE");
            if (bundle != null)
            {
                var cachedScreenshotPath = bundle.GetString(cachedImage);
                if (!string.IsNullOrEmpty(cachedScreenshotPath))
                {
                    var cachedScreenShot = LoadTmpFile(); 
                    if (cachedScreenShot != null)
                    {
                        layoutPb.Visibility = ViewStates.Gone;
                        iView.Visibility = ViewStates.Visible; 
                        var bitmap = CreateBitmapFromBytes(cachedScreenShot);
                        iView.SetImageBitmap(bitmap);
                    }
                }
            }
            else
            {
                TakeScreenshot(ScreenshotType.All);
            }   
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.work_path_fragment, container, false);
			workPathLayout = view.FindViewById<LinearLayout>(Resource.Id.work_path_layout);
			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			string workPath = Pref.WorkPath;
			workPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.work_path_fragment);
			workPathFragment.RefreshFilesList(workPath);
			workPathFragment.SnackbarView = coordinatorLayout;
			//workPathFragment.PrefKey = Pref.WorkPathKey;

			etWorkPath = view.FindViewById<EditText>(Resource.Id.etWorkPath);
			etWorkPath.Text = workPath;
			etWorkPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
			{
				try {
					var dir = new DirectoryInfo(etWorkPath.Text);
					if (dir.IsDirectory()) {
						Pref.WorkPath = etWorkPath.Text;
					} else {
						Show("잘못된 경로: " + etWorkPath.Text);
						etWorkPath.Text = Pref.WorkPath;
					}
				} catch {
					Show("잘못된 경로: " + etWorkPath.Text);
					etWorkPath.Text = Pref.WorkPath;
				}
				workPathFragment.RefreshFilesList(etWorkPath.Text);
			};
			etWorkPath.KeyPress += (object sender, View.KeyEventArgs e) =>
			{
				e.Handled = false;
				if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) {
					var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(etWorkPath.WindowToken, 0);
					etWorkPath.ClearFocus();
					e.Handled = true;
				}
			};

			workPathToolbar = view.FindViewById<Toolbar>(Resource.Id.work_path_toolbar);
			workPathToolbar.InflateMenu(Resource.Menu.toolbar_work_path_menu);
			workPathToolbar.MenuItemClick += (sender, e) =>
			{
				//Toast.MakeText(this, "Bottom toolbar pressed: " + e.Item.TitleFormatted, ToastLength.Short).Show();
				bool ret;
				switch (e.Item.ItemId) {
					case Resource.Id.toolbar_work_path_menu_up:
					OnBackPressedFragment();
					break;
					case Resource.Id.toolbar_work_path_menu_home:
					if (!Refresh(Pref.WorkPath))
						Show("경로 이동 실패: " + Pref.WorkPath);
					break;
					case Resource.Id.toolbar_work_path_menu_storage:
					if (!Refresh("/storage"))
						Show("경로 이동 실패: " + "/storage");
					break;
					case Resource.Id.toolbar_work_path_menu_sdcard:
					if (!Refresh(Environment.ExternalStorageDirectory.AbsolutePath))
						Show("경로 이동 실패: " + Environment.ExternalStorageDirectory.AbsolutePath);
					break;
					case Resource.Id.toolbar_work_path_menu_extsdcard:
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("ext") || item.Name.ToLower().StartsWith("sdcard1")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (Refresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "SD 카드");
					break;
					case Resource.Id.toolbar_work_path_menu_usbstorage:
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("usb")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (Refresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "USB 저장소");
					break;
				}
			};

			fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab);
			fab.Click += (sender, e) =>
			{
				etWorkPath.Text = workPathFragment.DirPath;
				Pref.WorkPath = etWorkPath.Text;
				workPathFragment.RefreshFilesList();
				Show("경로 설정 완료: " + etWorkPath.Text);
			};

			return view;
		}
        protected override void OnCreate(Bundle savedInstanceState)

        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(WindowFeatures.ActionBar);
            dialog = ConnectionDialog.NewInstance();
            SetContentView(Resource.Layout.main_activity_layout);
            canvas_view = FindViewById <RelativeLayout>(Tutorial.Android.Resource.Id.canvas_container);


            //menu and toolbar

            V7Toolbar toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            SupportActionBar.SetTitle(Resource.String.actionbar_title);
            SupportActionBar.SetHomeButtonEnabled(false);
            toolbar.SetNavigationIcon(Resource.Drawable.icon);
            toolbar.InflateMenu(Resource.Menu.menu_main);


            //FrameRateLogger frl = new FrameRateLogger();
            if (SupportedOpenGLVersion() >= 3)
            {
                // SetContentView(new LibPaintingView(ApplicationContext, null));
                // Inject Fusee.Engine.Base InjectMe dependencies

                IO.IOImp = new IOImp(ApplicationContext);

                var fap = new Fusee.Base.Imp.Android.ApkAssetProvider(ApplicationContext);

                fap.RegisterTypeHandler(

                    new AssetHandler

                {
                    ReturnedType = typeof(Font),

                    Decoder = delegate(string id, object storage)

                    {
                        if (Path.GetExtension(id).ToLower().Contains("ttf"))
                        {
                            return new Font

                            {
                                _fontImp = new FontImp((Stream)storage)
                            }
                        }
                        ;

                        return(null);
                    },

                    Checker = delegate(string id)
                    {
                        return(Path.GetExtension(id).ToLower().Contains("ttf"));
                    }
                });
Esempio n. 24
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            toolbar.InflateMenu(Resource.Menu.MenuMap);

            return(base.OnCreateOptionsMenu(menu));
        }
Esempio n. 25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            /*tablayout*/
            TabLayout tab = FindViewById <TabLayout>(Resource.Id.tabMain);

            tab.AddTab(tab.NewTab().SetText("小猪"));
            tab.AddTab(tab.NewTab().SetText("社会"));
            tab.AddTab(tab.NewTab().SetText("教育"));
            // 设置TabLayout的“长度”
            SetIndicator(tab, 25, 25);
            /*viewpage*/
            var viewPager = FindViewById <ViewPager>(Resource.Id.ly_content);
            var mAdapter  = new MyFragmentPagerAdapter(SupportFragmentManager, tab.TabCount);

            viewPager.Adapter     = mAdapter;
            viewPager.CurrentItem = 0;
            //Tab 选择事件
            tab.TabSelected += (s, e) =>
            {
                viewPager.CurrentItem = e.Tab.Position;
            };
            viewPager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tab));//关联Tablayout+Viewpager
            /*toolbar右侧菜单*/
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.InflateMenu(Resource.Menu.actionMenu); //填充actionMenu菜单项
            toolbar.MenuItemClick += (s, e) =>             //菜单项单击事件
            {
                if (e.Item.ItemId == Resource.Id.menu_add)
                {
                    Toast.MakeText(this, "添加菜单项", ToastLength.Short).Show();
                }
                else if (e.Item.ItemId == Resource.Id.menu_edit)
                {
                    Toast.MakeText(this, "编辑菜单项", ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(this, "搜索菜单项", ToastLength.Short).Show();
                }
            };
            /*左菜单的list*/
            ListView listview_leftMenu = FindViewById <ListView>(Resource.Id.left_menu);

            string[]     menus   = new string[] { "登录", "检查更新", "关于我们" };
            ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleExpandableListItem1, menus);

            listview_leftMenu.Adapter    = new MyCustomeAdapter(this, menus);
            listview_leftMenu.ItemClick += (o, e) =>
            {
                if (menus[e.Position] == "检查更新")
                {
                    Task startupWork = new Task(() => { ToUpDate(); });
                    startupWork.Start();
                }
            };
            /*左菜单呼出按钮*/
            DrawerLayout drawerLayout       = FindViewById <DrawerLayout>(Resource.Id.left_Active);
            Button       ToolBarUser_button = FindViewById <Button>(Resource.Id.ToolBarUser_button);

            ToolBarUser_button.Click += (o, e) =>
            {
                drawerLayout.OpenDrawer((int)GravityFlags.Start);
            };
            /*登录按钮*/
            Button LoginOrSign = FindViewById <Button>(Resource.Id.LoginOrSign);

            LoginOrSign.Click += (o, e) =>
            {
                Task startupWork = new Task(() => { ToLoginOrSign(); });
                startupWork.Start();
            };
            /*设置状态栏*/
            StatusBarUtil.SetColorStatusBar(this);
        }
Esempio n. 26
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view              = inflater.Inflate(Resource.Layout.backup_path_fragment, container, false);
            backupPathLayout  = view.FindViewById <LinearLayout>(Resource.Id.backup_path_layout);
            coordinatorLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.coordinator_layout);

            string backupPath = Pref.BackupPath;

            backupPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.backup_path_fragment);
            backupPathFragment.RefreshFilesList(backupPath);
            backupPathFragment.SnackbarView = coordinatorLayout;
            //backupPathFragment.PrefKey = Pref.BackupPathKey;

            etBackupPath              = view.FindViewById <EditText>(Resource.Id.etBackupPath);
            etBackupPath.Text         = backupPath;
            etBackupPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
            {
                try {
                    var dir = new DirectoryInfo(etBackupPath.Text);
                    if (dir.IsDirectory())
                    {
                        Pref.BackupPath = etBackupPath.Text;
                    }
                    else
                    {
                        Show("잘못된 경로: " + etBackupPath.Text);
                        etBackupPath.Text = Pref.BackupPath;
                    }
                } catch {
                    Show("잘못된 경로: " + etBackupPath.Text);
                    etBackupPath.Text = Pref.BackupPath;
                }
                backupPathFragment.RefreshFilesList(etBackupPath.Text);
            };
            etBackupPath.KeyPress += (object sender, View.KeyEventArgs e) =>
            {
                e.Handled = false;
                if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape)
                {
                    var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
                    imm.HideSoftInputFromWindow(etBackupPath.WindowToken, 0);
                    etBackupPath.ClearFocus();
                    e.Handled = true;
                }
            };

            backupPathToolbar = view.FindViewById <Toolbar>(Resource.Id.backup_path_toolbar);
            backupPathToolbar.InflateMenu(Resource.Menu.toolbar_backup_path_menu);
            backupPathToolbar.MenuItemClick += (sender, e) =>
            {
                switch (e.Item.ItemId)
                {
                case Resource.Id.toolbar_backup_path_menu_up:
                    OnBackPressedFragment();
                    break;

                case Resource.Id.toolbar_backup_path_menu_home:
                    Refresh(Pref.BackupPath);
                    break;

                case Resource.Id.toolbar_backup_path_menu_restore:
                    Show(Restore());
                    break;
                }
            };

            fab        = view.FindViewById <FloatingActionButton>(Resource.Id.fab);
            fab.Click += (sender, e) =>
            {
                Show(Backup());
            };

            return(view);
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.backup_path_fragment, container, false);
			backupPathLayout = view.FindViewById<LinearLayout>(Resource.Id.backup_path_layout);
			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			string backupPath = Pref.BackupPath;
			backupPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.backup_path_fragment);
			backupPathFragment.RefreshFilesList(backupPath);
			backupPathFragment.SnackbarView = coordinatorLayout;
			//backupPathFragment.PrefKey = Pref.BackupPathKey;

			etBackupPath = view.FindViewById<EditText>(Resource.Id.etBackupPath);
			etBackupPath.Text = backupPath;
			etBackupPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
			{
				try {
					var dir = new DirectoryInfo(etBackupPath.Text);
					if (dir.IsDirectory()) {
						Pref.BackupPath = etBackupPath.Text;
					} else {
						Show("잘못된 경로: " + etBackupPath.Text);
						etBackupPath.Text = Pref.BackupPath;
					}
				} catch {
					Show("잘못된 경로: " + etBackupPath.Text);
					etBackupPath.Text = Pref.BackupPath;
				}
				backupPathFragment.RefreshFilesList(etBackupPath.Text);
			};
			etBackupPath.KeyPress += (object sender, View.KeyEventArgs e) =>
			{
				e.Handled = false;
				if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) {
					var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(etBackupPath.WindowToken, 0);
					etBackupPath.ClearFocus();
					e.Handled = true;
				}
			};

			backupPathToolbar = view.FindViewById<Toolbar>(Resource.Id.backup_path_toolbar);
			backupPathToolbar.InflateMenu(Resource.Menu.toolbar_backup_path_menu);
			backupPathToolbar.MenuItemClick += (sender, e) =>
			{
				switch (e.Item.ItemId) {
					case Resource.Id.toolbar_backup_path_menu_up:
						OnBackPressedFragment();
						break;
					case Resource.Id.toolbar_backup_path_menu_home:
						Refresh(Pref.BackupPath);
						break;
					case Resource.Id.toolbar_backup_path_menu_restore:
						Show(Restore());
						break;
				}
			};

			fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab);
			fab.Click += (sender, e) =>
			{
				Show(Backup());
			};

			return view;
		}