protected override void OnViewModelSet()
        {
            Title = ViewModel.Group.DisplayName;
            SetContentView(Resource.Layout.GroupActivity);
            base.OnViewModelSet();

            // Get toolbar and set title.
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            toolbar.Title = Title;

            // Configure tab layout.
            var viewPager = FindViewById <ViewPager>(Resource.Id.view_pager);

            viewPager.Adapter = new GroupViewFragmentsAdapter(this);

            var tabLayout = FindViewById <TabLayout>(Resource.Id.tab_layout);

            tabLayout.SetupWithViewPager(viewPager);

            // Get the FABs and hook up the event listeners.
            _editDetailsActionButton = FindViewById <FloatingActionButton>(Resource.Id.edit_details_fab);
            _addFileActionButton     = FindViewById <FloatingActionButton>(Resource.Id.add_file_fab);
            viewPager.PageSelected  += OnPageSelected;
            OnPageSelected(null, new ViewPager.PageSelectedEventArgs(
                               tabLayout.SelectedTabPosition));
        }
 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     view = inflater.Inflate(Resource.Layout.DescribeImageWithVoiceFragment, container, false);
     imgVoiceDescription            = view.FindViewById <ImageView>(Resource.Id.voiceImage);
     btnAnalyzeVoiceImage           = view.FindViewById <Button>(Resource.Id.btnAnalyzeVoiceImage);
     imgButnChooseVoiceImage        = view.FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imgButnChooseVoiceImage);
     imgButnChooseVoiceImage.Click += handleChooseVoiceImage;
     btnAnalyzeVoiceImage.Click    += handleAnalyzeVoiceImage;
     return(view);
 }
예제 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);

                // Set our view from the "Tabbed_Main_Page" layout resource
                SetContentView(Resource.Layout.Tabbed_Main_Page);

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

                if (AppSettings.Show_Title_Username)
                {
                    toolBar.Title = UserDetails.Username;
                }
                else
                {
                    toolBar.Title = AppSettings.Application_Name;
                }

                SetSupportActionBar(toolBar);

                ActionBar ab = SupportActionBar;

                tabs      = FindViewById <TabLayout>(Resource.Id.tabs);
                viewPager = FindViewById <ViewPager>(Resource.Id.viewpager);
                FloatingActionButtonView     = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButtonView);
                StoryMultiButtons            = FindViewById <FloatingActionMenu>(Resource.Id.multistroybutton);
                StoryMultiButtons.Visibility = ViewStates.Invisible;

                StoryMultiButtons.GetChildAt(0).Click += OnImage_Button_Click;
                StoryMultiButtons.GetChildAt(1).Click += OnVideo_Button_Click;
                viewPager.PageScrolled         += ViewPager_PageScrolled;
                viewPager.PageSelected         += ViewPager_OnPageSelected;
                FloatingActionButtonView.Click += FloatingActionButtonView_Click;

                viewPager.OffscreenPageLimit = 3;
                SetUpViewPager(viewPager);
                tabs.SetupWithViewPager(viewPager);
                FloatingActionButtonView.Tag = "LastMessages";
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view = inflater.Inflate(Resource.Layout.FamilyThreePhoto, container, false);
            var metrics = Resources.DisplayMetrics;
            int width   = metrics.WidthPixels;
            int height  = metrics.HeightPixels;

            imgvFather                = view.FindViewById <ImageView>(Resource.Id.imgvFather);
            imgvMother                = view.FindViewById <ImageView>(Resource.Id.imgvMother);
            imgvChildren              = view.FindViewById <ImageView>(Resource.Id.imgvChildren);
            btnFatherChoose           = view.FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.btnFatherChoose);
            btnChooseMother           = view.FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.btnChooseMother);
            btnChooseChildren         = view.FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.btnChooseChildren);
            relativeLayout1           = view.FindViewById <LinearLayout>(Resource.Id.relativeLayout1);
            relativeLayout2           = view.FindViewById <LinearLayout>(Resource.Id.relativeLayout2);
            relativeLayout3           = view.FindViewById <LinearLayout>(Resource.Id.relativeLayout3);
            btnCheckSimilarityAnalyze = view.FindViewById <Button>(Resource.Id.btnCheckSimilarityAnalyze);
            fatherList                = view.FindViewById <ListView>(Resource.Id.fatherList);

            imgvFather.LayoutParameters.Width       = width / 2 - 50;
            imgvFather.LayoutParameters.Height      = width / 2 - 50;
            imgvMother.LayoutParameters.Width       = width / 2 - 50;
            imgvMother.LayoutParameters.Height      = width / 2 - 50;
            imgvChildren.LayoutParameters.Width     = width / 2 - 50;
            imgvChildren.LayoutParameters.Height    = width / 2 - 50;
            relativeLayout1.LayoutParameters.Width  = width / 2 - 50;
            relativeLayout2.LayoutParameters.Width  = width / 2 - 50;
            relativeLayout3.LayoutParameters.Width  = width / 2 - 50;
            relativeLayout1.LayoutParameters.Height = width / 2 - 50;
            relativeLayout2.LayoutParameters.Height = width / 2 - 50;
            relativeLayout3.LayoutParameters.Height = width / 2 - 50;

            btnFatherChoose.Click           += HandleFatherChoose;
            btnChooseMother.Click           += HandleMotherChoose;
            btnChooseChildren.Click         += HandleChildrenChoose;
            btnCheckSimilarityAnalyze.Click += HandleBtnCheckSimilarityAnalysis;

            return(view);
        }
예제 #5
0
        private void InitComponent(View view)
        {
            try
            {
                CollapsingToolbar       = (CollapsingToolbarLayout)view.FindViewById(Resource.Id.collapsingToolbar);
                CollapsingToolbar.Title = "";

                AppBarLayout = view.FindViewById <AppBarLayout>(Resource.Id.appBarLayout);
                AppBarLayout.SetExpanded(true);
                AppBarLayout.AddOnOffsetChangedListener(this);

                LoadingLayout            = (LinearLayout)view.FindViewById(Resource.Id.Loading_LinearLayout);
                LoadingLayout.Visibility = ViewStates.Visible;

                SwipeRefreshLayout = (SpringView)view.FindViewById(Resource.Id.material_style_ptr_frame);
                SwipeRefreshLayout.SetType(SpringView.Type.Overlap);
                SwipeRefreshLayout.Header = new DefaultHeader(Activity);
                SwipeRefreshLayout.Footer = new Helpers.PullSwipeStyles.DefaultFooter(Activity);
                SwipeRefreshLayout.Enable = true;
                SwipeRefreshLayout.SetListener(this);

                ButtonMore        = (ImageButton)view.FindViewById(Resource.Id.more);
                ButtonMore.Click += ButtonMoreOnClick;

                IconInfo        = (TextView)view.FindViewById(Resource.Id.info);
                IconInfo.Click += IconInfoOnClick;

                ImageAvatar = (ImageView)view.FindViewById(Resource.Id.imageAvatar);
                ImageCover  = (ImageView)view.FindViewById(Resource.Id.imageCover);

                TxtFullName = (TextView)view.FindViewById(Resource.Id.fullNameTextView);
                TxtUserName = (TextView)view.FindViewById(Resource.Id.userNameTextView);

                TxtFollowers             = (TextView)view.FindViewById(Resource.Id.FollowersTextView);
                TxtCountFollowers        = (TextView)view.FindViewById(Resource.Id.countFollowersTextView);
                TxtFollowers.Click      += TxtFollowersOnClick;
                TxtCountFollowers.Click += TxtFollowersOnClick;

                TxtFollowing             = (TextView)view.FindViewById(Resource.Id.FollowingTextView);
                TxtCountFollowing        = (TextView)view.FindViewById(Resource.Id.countFollowingTextView);
                TxtFollowing.Click      += TxtFollowingOnClick;
                TxtCountFollowing.Click += TxtFollowingOnClick;

                IconCamera   = (TextView)view.FindViewById(Resource.Id.iconCamera);
                IconVerified = (TextView)view.FindViewById(Resource.Id.verified);
                IconPro      = (TextView)view.FindViewById(Resource.Id.pro);

                EmptyStateLayout    = (ViewStub)view.FindViewById(Resource.Id.viewStub);
                LatestSongsViewStub = (ViewStub)view.FindViewById(Resource.Id.viewStubLatestSongs);
                TopSongsViewStub    = (ViewStub)view.FindViewById(Resource.Id.viewStubTopSongs);
                AlbumsViewStub      = (ViewStub)view.FindViewById(Resource.Id.viewStubAlbums);
                StoreViewStub       = (ViewStub)view.FindViewById(Resource.Id.viewStubStore);
                ActivitiesViewStub  = (ViewStub)view.FindViewById(Resource.Id.viewStubActivities);

                TxtAbout = (AutoLinkTextView)view.FindViewById(Resource.Id.AboutTextview);

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, IconCamera, IonIconsFonts.AndroidCamera);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, IconVerified, IonIconsFonts.CheckmarkCircled);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconPro, FontAwesomeIcon.Rocket);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, IconInfo, IonIconsFonts.InformationCircled);

                IconVerified.Visibility = ViewStates.Invisible;
                IconPro.Visibility      = ViewStates.Invisible;

                BtnEdit        = (FloatingActionButton)view.FindViewById(Resource.Id.fab);
                BtnEdit.Click += BtnEditOnClick;

                ImageAvatar.Click += ImageAvatarOnClick;
                IconCamera.Click  += ImageAvatarOnClick;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #6
0
 /// <summary>
 /// ////////////////////////////////////////// Send button //////////////////////////////////////////
 /// </summary>
 private void InitFABSend()
 {
     mFABSend            = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.id_fab_send);
     mFABSend.Click     += MFABSend_Click;
     mFABSend.LongClick += MFABSend_LongClick;
 }
예제 #7
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);
        }
예제 #8
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);
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.weld_condition_fragment, container, false);

			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			selectedBackGroundColor = Context.Resources.GetColor(Resource.Color.tab3_textview_background);
			listView = view.FindViewById<ListView>(Resource.Id.wcdListView);
			listView.Adapter = wcdListAdapter;
			listView.FastScrollEnabled = false;
			listView.ChoiceMode = ChoiceMode.Multiple;
			listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
			{
				wcdListAdapter[e.Position].ItemChecked = listView.IsItemChecked(e.Position);
				if (listView.IsItemChecked(e.Position)) {
					lastPosition = e.Position;
					e.View.SetBackgroundColor(selectedBackGroundColor);
				} else {
					e.View.SetBackgroundColor(defaultBackgroundColor);  // 기본 백그라운드 색깔
				}

				try {
					if (wcdListAdapter.Count == 0)
						fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
					else if (listView.CheckedItemCount == 0)
						fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
					else
						fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
				} catch { }

				if (snackbar == null)
					snackbar = Snackbar.Make(coordinatorLayout, listView.CheckedItemCount.ToString() + "개 항목 선택됨", Snackbar.LengthIndefinite)
							.SetAction("선택 취소", (view) => { CheckListItem(); snackbar = null; });
				if (listView.CheckedItemCount > 0) {
					if (snackbar.IsShown)
						snackbar.SetText(listView.CheckedItemCount.ToString() + "개 항목 선택됨");
					else
						snackbar.Show();
				} else if (snackbar != null) {
					snackbar.Dismiss();
					snackbar = null;
				}
			};
			listView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) =>
			{
				FabWcd_Click(sender, e);
			};

			var refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.srl);
			if (refresher != null) {
				refresher.Refresh += delegate
				{
					Refresh(forced: true);
					refresher.Refreshing = false;
				};
			}

			// 떠 있는 액션버튼
			fabWcd = view.FindViewById<FloatingActionButton>(Resource.Id.fab_wcd);
			fabWcd.Click += (object sender, EventArgs e) =>
			{
				if (listView.CheckedItemCount == 0)
					Pref.TextViewDialog(Context, robotPath);
				else
					FabWcd_Click(sender, e);
			};

			try {
				if (wcdListAdapter.Count == 0)
					fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
				else if (listView.CheckedItemCount == 0)
					fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
				else
					fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
			} catch { }

			return view;
		}
		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;
		}
		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;
		}
예제 #12
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view = inflater.Inflate(Resource.Layout.weld_condition_fragment, container, false);

            coordinatorLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.coordinator_layout);

            selectedBackGroundColor = Context.Resources.GetColor(Resource.Color.tab3_textview_background);
            listView                   = view.FindViewById <ListView>(Resource.Id.wcdListView);
            listView.Adapter           = wcdListAdapter;
            listView.FastScrollEnabled = false;
            listView.ChoiceMode        = ChoiceMode.Multiple;
            listView.ItemClick        += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                wcdListAdapter[e.Position].ItemChecked = listView.IsItemChecked(e.Position);
                if (listView.IsItemChecked(e.Position))
                {
                    lastPosition = e.Position;
                    e.View.SetBackgroundColor(selectedBackGroundColor);
                }
                else
                {
                    e.View.SetBackgroundColor(defaultBackgroundColor);                      // 기본 백그라운드 색깔
                }

                try {
                    if (wcdListAdapter.Count == 0)
                    {
                        fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
                    }
                    else if (listView.CheckedItemCount == 0)
                    {
                        fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
                    }
                    else
                    {
                        fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
                    }
                } catch { }

                if (snackbar == null)
                {
                    snackbar = Snackbar.Make(coordinatorLayout, listView.CheckedItemCount.ToString() + "개 항목 선택됨", Snackbar.LengthIndefinite)
                               .SetAction("선택 취소", (view) => { CheckListItem(); snackbar = null; });
                }
                if (listView.CheckedItemCount > 0)
                {
                    if (snackbar.IsShown)
                    {
                        snackbar.SetText(listView.CheckedItemCount.ToString() + "개 항목 선택됨");
                    }
                    else
                    {
                        snackbar.Show();
                    }
                }
                else if (snackbar != null)
                {
                    snackbar.Dismiss();
                    snackbar = null;
                }
            };
            listView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) =>
            {
                FabWcd_Click(sender, e);
            };

            var refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.srl);

            if (refresher != null)
            {
                refresher.Refresh += delegate
                {
                    Refresh(forced: true);
                    refresher.Refreshing = false;
                };
            }

            // 떠 있는 액션버튼
            fabWcd        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_wcd);
            fabWcd.Click += (object sender, EventArgs e) =>
            {
                if (listView.CheckedItemCount == 0)
                {
                    Pref.TextViewDialog(Context, robotPath);
                }
                else
                {
                    FabWcd_Click(sender, e);
                }
            };

            try {
                if (wcdListAdapter.Count == 0)
                {
                    fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
                }
                else if (listView.CheckedItemCount == 0)
                {
                    fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
                }
                else
                {
                    fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
                }
            } catch { }

            return(view);
        }