protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); UserDialogs.Init(this); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Instance = this; listView = FindViewById <ListView>(Resource.Id.lvresults); listView.ItemClick += OnListItemClick; toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "TorrentTools"; SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_backarrow); //SupportActionBar.SetDisplayHomeAsUpEnabled(true); layoutWelcome = FindViewById <RelativeLayout>(Resource.Id.layout_welcome); tvStatusText = FindViewById <IconTextView>(Resource.Id.status_text); rlStatusLayout = FindViewById <RelativeLayout>(Resource.Id.status_layout); rlStatusLayout.Visibility = Android.Views.ViewStates.Gone; torSearchView = FindViewById <Android.Support.V7.Widget.SearchView>(Resource.Id.menu_search); statusAnimShow = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_slide_in_top); listViewAnimShow = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_slide_in_bottom); statusAnimHide = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_fade_out); welcomeAnimShow = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_grow_fade_in_from_bottom); welcomeAnimShow.Duration = 1000; layoutWelcome.Animation = welcomeAnimShow; listViewAnimHide = AnimationUtils.LoadAnimation(this, Resource.Animation.abc_slide_out_bottom); Iconify.with(new MaterialModule()); Iconify.with(new FontAwesomeModule()); Iconify.with(new MaterialCommunityModule()); //layoutWelcome.Visibility = ViewStates.Visible; //LoadFragment("SearchFragment"); IsConnected = true; searchCategory = TpbTorrentCategory.All; searchOrder = TpbQueryOrder.ByDefault; var searchFragment = new SearchFragment(); SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.content_frame, searchFragment) .Commit(); //Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged; //Check network connection //var current = Connectivity.NetworkAccess; //if (current != NetworkAccess.Internet) //{ // Toast.MakeText(this, "No internet connection detected", ToastLength.Short).Show(); // } }
public void LoadFragment(string fragmentName) { Android.Support.V4.App.Fragment fragment = null; if (fragmentName == "SearchFragment") { fragment = new SearchFragment(); } if (fragmentName == "SearchResultsFragment") { fragment = new SearchResultsFragment(); } if (fragment == null) { return; } SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.content_frame, fragment) .AddToBackStack(null) .Commit(); }