예제 #1
0
        private void LoadFragment(int id)
        {
            Fragment fragment = null;

            switch (id)
            {
            case Resource.Id.menu_home:
                // fragment = Fragment1.NewInstance();
                break;

            case Resource.Id.menu_library:
                // fragment = Fragment2.NewInstance();
                break;

            case Resource.Id.menu_search:
                fragment = SearchFragment.NewInstance();
                break;

            case Resource.Id.menu_menu:
                // fragment = Fragment1.NewInstance();
                break;
            }

            if (fragment == null)
            {
                return;
            }

            FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, fragment).Commit();
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var builder = new StrictMode.VmPolicy.Builder();
            var policy  = builder.DetectActivityLeaks().PenaltyLog().Build();

            StrictMode.SetVmPolicy(policy);

            SetContentView(Resource.Layout.Main);

            SearchView     = FindViewById <Android.Widget.SearchView>(Resource.Id.SearchView);
            StateIndicator = FindViewById <TextView>(Resource.Id.StateIndicator);
            TryNewScreen   = FindViewById <Button>(Resource.Id.OpenNewActivity);

            TryNewScreen.Click += GoToSecondScreen;

            retainedFragment = FragmentManager.FindFragmentByTag("SearchPresenter") as SearchFragment;

            if (retainedFragment == null)
            {
                retainedFragment = new SearchFragment();
                FragmentManager.BeginTransaction().Add(retainedFragment, "SearchPresenter").Commit();
                retainedFragment.Presenter = new SearchPresenter(new SearchUseCase(new MySearchApi()));
            }

            retainedFragment.Presenter.AttachView(this);
            retainedFragment.Presenter.BindIntents();
        }
예제 #3
0
        public void OnFocusChange(View v, bool hasFocus)
        {
            if (v.Id != SearchBox.Id || !hasFocus)
            {
                return;
            }

            SearchFragment searchFragment = new SearchFragment();

            GlobalContext.FragmentBottomNavigator.DisplayFragment(searchFragment);
            SearchBox.ClearFocus();
        }
예제 #4
0
 //Open Search Page
 private void SearchIconOnClick(object sender, EventArgs e)
 {
     try
     {
         SearchFragment searchFragment = new SearchFragment();
         GlobalContext?.FragmentBottomNavigator.DisplayFragment(searchFragment);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
예제 #5
0
        public void OnClick(View v)
        {
            if (v.Id != SearchBox.Id)
            {
                return;
            }

            SearchFragment searchFragment = new SearchFragment();

            GlobalContext.FragmentBottomNavigator.DisplayFragment(searchFragment);
            SearchBox.ClearFocus();
        }
예제 #6
0
        public void SwitchSearch()
        {
            FragmentTransaction transaction = SupportFragmentManager.BeginTransaction();

            if (searchFragment == null)
            {
                searchFragment = new SearchFragment();
                transaction.Add(Resource.Id.frameContent, searchFragment).CommitNowAllowingStateLoss();
            }
            else
            {
                transaction.Show(searchFragment).CommitNowAllowingStateLoss();
            }
        }
예제 #7
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            TryNewScreen.Click -= GoToSecondScreen;
            retainedFragment.Presenter.DetachView();
            retainedFragment.Presenter.UnBindIntents();

            if (IsFinishing)
            {
                retainedFragment.Presenter.OnDestroy();
                retainedFragment.Presenter = null;
                retainedFragment           = null;
            }
        }
예제 #8
0
        public void AutoLinkTextViewOnAutoLinkOnClick(object sender, AutoLinkOnClickEventArgs autoLinkOnClickEventArgs)
        {
            try
            {
                AutoLinkMode matchedText = autoLinkOnClickEventArgs.P0;
                var          typeText    = Methods.FunString.Check_Regex(autoLinkOnClickEventArgs.P1);
                if (typeText == "Email" || matchedText == AutoLinkMode.ModeEmail)
                {
                    Methods.App.SendEmail(Application.Context, autoLinkOnClickEventArgs.P1);
                }
                else if (typeText == "Website" || matchedText == AutoLinkMode.ModeUrl)
                {
                    string url = autoLinkOnClickEventArgs.P1;
                    if (!autoLinkOnClickEventArgs.P1.Contains("http"))
                    {
                        url = "http://" + autoLinkOnClickEventArgs.P1;
                    }

                    var intent = new Intent(Application.Context, typeof(LocalWebViewActivity));
                    intent.PutExtra("URL", url);
                    intent.PutExtra("Type", url);
                    Activity.StartActivity(intent);
                }
                else if (typeText == "Hashtag" || matchedText == AutoLinkMode.ModeHashtag)
                {
                    Bundle bundle = new Bundle();
                    bundle.PutString("Key", autoLinkOnClickEventArgs.P1.Replace("#", ""));
                    SearchFragment searchFragment = new SearchFragment
                    {
                        Arguments = bundle
                    };
                    HomeActivity.GetInstance()?.FragmentBottomNavigator.DisplayFragment(searchFragment);
                }
                else if (typeText == "Mention" || matchedText == AutoLinkMode.ModeMention)
                {
                }
                else if (typeText == "Number" || matchedText == AutoLinkMode.ModePhone)
                {
                    //IMethods.IApp.SaveContacts(Activity, autoLinkOnClickEventArgs.P1, "", "2");
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == Resource.Id.SearchMenuItem)
            {
                var searchFragment = new SearchFragment();
                var transaction    = SupportFragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.MainFrameLayout, searchFragment);
                transaction.AddToBackStack(null); // Name?
                transaction.Commit();
                return(true);
            }
            else if (drawerToggle.OnOptionsItemSelected(item))
            {
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
예제 #10
0
        private void SearchViewLinearLayoutOnClick(object sender, EventArgs e)
        {
            try
            {
                Bundle bundle = new Bundle();
                bundle.PutString("Key", "");
                SearchFragment = new SearchFragment()
                {
                    Arguments = bundle
                };

                GlobalContext.FragmentBottomNavigator.DisplayFragment(SearchFragment);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
예제 #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            AndroidX.AppCompat.Widget.Toolbar toolbar = FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            mExternalLogger    = ExternalLogger.Instance;
            mTripStateListener = new TutorialTripStateListener(this, mExternalLogger);

            mSirlMapFragment    = (SirlMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map);
            mSirlSearchFragment = (SearchFragment)SupportFragmentManager.FindFragmentById(Resource.Id.search_bar);

            setupSirl();
        }
예제 #12
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            Fragment f;
            var      title = FindViewById <TextView>(Resource.Id.titlebar_title);

            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                // textMessage.SetText(Resource.String.title_home);
                f = new RecommendationsFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Рекомендации";
                return(true);

            case Resource.Id.navigation_tracks:
                f = new TracksFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Ваша музыка";
                return(true);

            case Resource.Id.navigation_popular:
                f = new ToDoFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Популярное";
                return(true);

            case Resource.Id.navigation_search:
                f = new SearchFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Поиск";
                return(true);

            case Resource.Id.navigation_settings:
                f = new SettingsFragment();
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, f).Commit();
                title.Text = "Настройки";
                return(true);
            }
            return(false);
        }
예제 #13
0
        protected override void initializeFragments()
        {
            base.initializeFragments();

            feedFragment    = new FeedFragment();
            searchFragment  = new SearchFragment();
            profileFragment = new ProfileFragment();

            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, searchFragment, "search");
            trans.Hide(searchFragment);

            trans.Add(Resource.Id.fragmentContainer, profileFragment, "profile");
            trans.Hide(profileFragment);

            trans.Add(Resource.Id.fragmentContainer, feedFragment, "feed");

            currentFragment = feedFragment;

            trans.Commit();
        }
        public void OnFocusChange(View v, bool hasFocus)
        {
            try
            {
                if (v.Id != SearchBox.Id || !hasFocus)
                {
                    return;
                }

                Bundle bundle = new Bundle();
                bundle.PutString("Key", "");
                SearchFragment = new SearchFragment
                {
                    Arguments = bundle
                };
                GlobalContext.FragmentBottomNavigator.DisplayFragment(SearchFragment);
                SearchBox.ClearFocus();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void EditTextOnClick(object sender, View.TouchEventArgs e)
        {
            try
            {
                if (e.Event.Action != MotionEventActions.Down)
                {
                    return;
                }

                Bundle bundle = new Bundle();
                bundle.PutString("Key", "");
                SearchFragment = new SearchFragment
                {
                    Arguments = bundle
                };
                GlobalContext.FragmentBottomNavigator.DisplayFragment(SearchFragment);
                SearchBox.ClearFocus();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container,
                                          Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            View view = inflater.Inflate(Resource.Layout.fragment_home, container, false);

            imageView   = view.FindViewById <ImageView>(Resource.Id.imageslider);
            footerImage = view.FindViewById <ImageView>(Resource.Id.imagefooterslider);
            headerIndex = 0;


            sharedPreferences = this.Activity.GetSharedPreferences(BaseURL.MyPrefreance, FileCreationMode.Private);

            rv_items = (RecyclerView)view.FindViewById(Resource.Id.rv_home);

            GridLayoutManager gridLayoutManager = new GridLayoutManager(this.Activity, 3);

            rv_items.SetLayoutManager(gridLayoutManager);
            rv_items.SetItemAnimator(new DefaultItemAnimator());
            rv_items.NestedScrollingEnabled = false;

            Search_layout = (LinearLayout)view.FindViewById(Resource.Id.search_layout);
            scrollView    = (ScrollView)view.FindViewById(Resource.Id.scroll_view);
            scrollView.SmoothScrollingEnabled = true;
            if (isOnline())
            {
                HeaderLoadImages();
                FooterLoadImages();
                setHeaderSlideShow();
                makeGetCategoryRequest();
            }

            Search_layout.Click += delegate
            {
                SearchFragment      trending_fragment = new SearchFragment();
                FragmentManager     m = FragmentManager;
                FragmentTransaction fragmentTransaction = m.BeginTransaction();
                fragmentTransaction.Replace(Resource.Id.contentPanel, trending_fragment);
                fragmentTransaction.Commit();
            };

            fabMain  = (FloatingActionButton)view.FindViewById(Resource.Id.fabMain);
            fabOne   = (FloatingActionButton)view.FindViewById(Resource.Id.fabOne);
            fabTwo   = (FloatingActionButton)view.FindViewById(Resource.Id.fabTwo);
            fabThree = (FloatingActionButton)view.FindViewById(Resource.Id.fabThree);
            fabfour  = (FloatingActionButton)view.FindViewById(Resource.Id.fabfour);



            fabOne.SetAlpha(0);
            fabTwo.SetAlpha(0);
            fabThree.SetAlpha(0);
            fabfour.SetAlpha(0);

            fabOne.TranslationY   = translationY;
            fabTwo.TranslationY   = translationY;
            fabThree.TranslationY = translationY;
            fabfour.TranslationY  = translationY;

            fabMain.Click  += FabMain_Click;
            fabOne.Click   += FabOne_Click;
            fabTwo.Click   += FabTwo_Click;
            fabThree.Click += FabThree_Click;
            fabfour.Click  += Fabfour_Click;

            tab1 = (TabItem)view.FindViewById(Resource.Id.top_selling_item);
            tab2 = (TabItem)view.FindViewById(Resource.Id.recent_item);
            tab3 = (TabItem)view.FindViewById(Resource.Id.deals_item);
            tab4 = (TabItem)view.FindViewById(Resource.Id.whtsnewitem);

            tabLayout = (TabLayout)view.FindViewById(Resource.Id.tablayout);
            viewPager = (ViewPager)view.FindViewById(Resource.Id.pager_product);

            pageAdapter            = new PageAdapter(ChildFragmentManager, 1);
            viewPager.Adapter      = pageAdapter;
            tabLayout.TabSelected += TabLayout_TabSelected;

            viewPager.AddOnPageChangeListener(new TabLayoutOnPageChangeListener(tabLayout));
            return(view);
        }
예제 #17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            //  Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            ActionBar.Hide();

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

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

            navigationView.SetNavigationItemSelectedListener(this);

            mFragment1     = new HomeFragment();
            mFragment2     = new HangarFragment();
            mFragment3     = new OrgFragment();
            mFragment4     = new TradeFragment();
            mFragment5     = new DatabankFragment();
            mFragment6     = new MissionsFragment();
            mFragment7     = new TradeportsFragment();
            mFragment8     = new CommadatiesFragment();
            mFragment9     = new MiningFragment();
            mFragment10    = new MyOrgFragment();
            mFragment11    = new SearchFragment();
            mFragment12    = new ShipsFragment();
            mFragment13    = new ComponentsFragment();
            mFragment14    = new StoresFragment();
            mStackFragment = new Stack <SupportFragment>();



            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, mFragment14, "Stores Fragment");
            trans.Hide(mFragment14);

            trans.Add(Resource.Id.fragmentContainer, mFragment13, "Components Fragment");
            trans.Hide(mFragment13);

            trans.Add(Resource.Id.fragmentContainer, mFragment12, "Ships Fragment");
            trans.Hide(mFragment12);

            trans.Add(Resource.Id.fragmentContainer, mFragment11, "Search Fragment");
            trans.Hide(mFragment11);

            trans.Add(Resource.Id.fragmentContainer, mFragment10, "MyOrg Fragment");
            trans.Hide(mFragment10);

            trans.Add(Resource.Id.fragmentContainer, mFragment9, "Mining Fragment");
            trans.Hide(mFragment9);

            trans.Add(Resource.Id.fragmentContainer, mFragment8, "Commadaties Fragment");
            trans.Hide(mFragment8);

            trans.Add(Resource.Id.fragmentContainer, mFragment7, "Tradeports Fragment");
            trans.Hide(mFragment7);

            trans.Add(Resource.Id.fragmentContainer, mFragment6, "Missions Fragment");
            trans.Hide(mFragment6);

            trans.Add(Resource.Id.fragmentContainer, mFragment5, "Databank Fragment");
            trans.Hide(mFragment5);

            trans.Add(Resource.Id.fragmentContainer, mFragment4, "Trade Fragment");
            trans.Hide(mFragment4);

            trans.Add(Resource.Id.fragmentContainer, mFragment3, "Org Fragment");
            trans.Hide(mFragment3);

            trans.Add(Resource.Id.fragmentContainer, mFragment2, "Hangar Fragment");
            trans.Hide(mFragment2);

            trans.Add(Resource.Id.fragmentContainer, mFragment1, "Home Fragment");
            trans.Commit();

            mCurrentFragment = mFragment1;
        }
예제 #18
0
        public void AutoLinkTextViewOnAutoLinkOnClick(object sender, AutoLinkOnClickEventArgs autoLinkOnClickEventArgs)
        {
            try
            {
                var typetext = Methods.FunString.Check_Regex(autoLinkOnClickEventArgs.P1);
                if (typetext == "Email")
                {
                    Methods.App.SendEmail(Activity, autoLinkOnClickEventArgs.P1);
                    return;
                }
                else if (typetext == "Website")
                {
                    String url = autoLinkOnClickEventArgs.P1;
                    if (!autoLinkOnClickEventArgs.P1.Contains("http"))
                    {
                        url = "http://" + autoLinkOnClickEventArgs.P1;
                    }

                    var intent = new Intent(Application.Context, typeof(LocalWebViewActivity));
                    intent.PutExtra("URL", url);
                    intent.PutExtra("Type", url);
                    Activity.StartActivity(intent);
                    return;
                }
                else if (typetext == "Hashtag")
                {
                    // Show All Post By Hash
                    Bundle bundle = new Bundle();
                    bundle.PutString("HashId", "");
                    bundle.PutString("HashName", Methods.FunString.DecodeString(autoLinkOnClickEventArgs.P1));

                    HashTagPostFragment profileFragment = new HashTagPostFragment
                    {
                        Arguments = bundle
                    };

                    ((HomeActivity)Activity).OpenFragment(profileFragment);

                    return;
                }
                else if (typetext == "Mention")
                {
                    Bundle bundle = new Bundle();
                    bundle.PutString("Key", Methods.FunString.DecodeString(autoLinkOnClickEventArgs.P1));

                    SearchFragment searchFragment = new SearchFragment()
                    {
                        Arguments = bundle
                    };

                    ((HomeActivity)Activity).OpenFragment(searchFragment);

                    return;
                }
                else if (typetext == "Number")
                {
                    // IMethods.App.SaveContacts(_activity, autoLinkOnClickEventArgs.P1, "", "2");
                    return;
                }
                else
                {
                    return;
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }