public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { var view = MyContextWrapper.GetContentView(Context, Settings.Lang, Resource.Layout.Tab_News_Feed_Layout); if (view == null) { view = inflater.Inflate(Resource.Layout.Tab_News_Feed_Layout, container, false); } coordinatorLayout = (CoordinatorLayout)view.FindViewById(Resource.Id.coordinator_Layout); StoryRecylerView = (RecyclerView)view.FindViewById(Resource.Id.Recyler); HybirdView = (WebView)view.FindViewById(Resource.Id.hybirdview); swipeRefreshLayout = (SwipeRefreshLayout)view.FindViewById(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight); swipeRefreshLayout.Refreshing = true; swipeRefreshLayout.Enabled = true; ScrollView = (NestedScrollView)view.FindViewById(Resource.Id.scroll_View); Stories_Layout = (LinearLayout)view.FindViewById(Resource.Id.StoriesLayout); News_Empty = (LinearLayout)view.FindViewById(Resource.Id.News_LinerEmpty); News_Icon = (TextView)view.FindViewById(Resource.Id.News_icon); Txt_News_Empty = (TextView)view.FindViewById(Resource.Id.Txt_LabelEmpty); Txt_News_start = (TextView)view.FindViewById(Resource.Id.Txt_LabelStart); Btn_Reload = (Button)view.FindViewById(Resource.Id.reloadPage_Button); IMethods.Set_TextViewIcon("2", News_Icon, "\uf119"); News_Empty.Visibility = ViewStates.Gone; StoryRecylerView.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false)); StoryAdapter = new StoryAdapter(Activity); StoryRecylerView.SetAdapter(StoryAdapter); StoryRecylerView.NestedScrollingEnabled = false; if (!Settings.SetTabOnButton) { var parasms = (CoordinatorLayout.LayoutParams)swipeRefreshLayout.LayoutParameters; parasms.Gravity = (int)GravityFlags.Top; // Check if we're running on Android 5.0 or higher if ((int)Build.VERSION.SdkInt < 23) { parasms.TopMargin = 100; } else { parasms.TopMargin = 225; } swipeRefreshLayout.LayoutParameters = parasms; } HybridController = new HybirdViewController(Activity, HybirdView); //Set WebView and Load url to be rendered on WebView if (!IMethods.CheckConnectivity()) { if (Settings.EnableCachSystem) { if (File.Exists(IMethods.IPath.FolderDiskPost + "news_feed.html")) { LoadCach = true; HybridController.HybirdView.Settings.CacheMode = CacheModes.CacheElseNetwork; var html = File.ReadAllText(IMethods.IPath.FolderDiskPost + "news_feed.html"); //HybridController.HybirdView.LoadData(html, "text/html", null); HybridController.HybirdView.LoadDataWithBaseURL(WoWonder_API.Client.WebsiteUrl, html, "text/html", "utf-8", null); } else { HybirdView.Visibility = ViewStates.Gone; News_Empty.Visibility = ViewStates.Visible; swipeRefreshLayout.Refreshing = false; Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News); Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection); } } else { HybirdView.Visibility = ViewStates.Gone; News_Empty.Visibility = ViewStates.Visible; swipeRefreshLayout.Refreshing = false; Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News); Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection); } } else { if (Settings.ClearCachSystem) { HybridController.HybirdView.ClearCache(true); } HybirdView.Visibility = ViewStates.Visible; News_Empty.Visibility = ViewStates.Gone; if (Settings.LoadCachedHybirdViewOnFirstLoad) { if (File.Exists(IMethods.IPath.FolderDiskPost + "news_feed.html")) { LoadCach = true; var html = File.ReadAllText(IMethods.IPath.FolderDiskPost + "news_feed.html"); //HybridController.HybirdView.LoadData(html, "text/html", null); HybridController.HybirdView.LoadDataWithBaseURL(WoWonder_API.Client.WebsiteUrl + "/get_news_feed", html, "text/html", "utf-8", null); } else { switch (Settings.Lang) { case "en": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ar": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie); Settings.FlowDirection_RightToLeft = true; break; case "de": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie); break; case "el": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie); break; case "es": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie); break; case "fr": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie); break; case "it": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ja": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie); break; case "nl": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie); break; case "pt": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ro": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ru": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "sq": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "sr": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "tr": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie); break; default: HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie); break; } } } else { switch (Settings.Lang) { case "en": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ar": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie); Settings.FlowDirection_RightToLeft = true; break; case "de": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie); break; case "el": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie); break; case "es": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie); break; case "fr": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie); break; case "it": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ja": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie); break; case "nl": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie); break; case "pt": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ro": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "ru": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "sq": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "sr": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie); break; case "tr": HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie); break; default: HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie); break; } } } if (Settings.Show_Story) { Stories_Layout.Visibility = ViewStates.Visible; GetStory_Api(); } else { Stories_Layout.Visibility = ViewStates.Gone; Get_Notifications(); } return(view); } catch (Exception e) { Crashes.TrackError(e); return(null); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); IMethods.IApp.FullScreenApp(this); var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.LocalWebView_layout); if (view != null) { SetContentView(view); } else { SetContentView(Resource.Layout.LocalWebView_layout); } var Type = Intent.GetStringExtra("Type") ?? "Data not available"; if (Type != "Data not available" && !string.IsNullOrEmpty(Type)) { PageType = Type; } var dataId = Intent.GetStringExtra("Id") ?? "Data not available"; if (dataId != "Data not available" && !string.IsNullOrEmpty(dataId)) { Id = dataId; } var dataTitle = Intent.GetStringExtra("Title") ?? "Data not available"; if (dataTitle != "Data not available" && !string.IsNullOrEmpty(dataTitle)) { TitlePage = dataTitle; } var ToolBar = FindViewById <Toolbar>(Resource.Id.toolbar); if (ToolBar != null) { ToolBar.Title = TitlePage; SetSupportActionBar(ToolBar); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); } HybirdView = FindViewById <WebView>(Resource.Id.LocalWebView); swipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.swipeRefreshLayout); News_Empty = (LinearLayout)FindViewById(Resource.Id.News_LinerEmpty); News_Icon = (TextView)FindViewById(Resource.Id.News_icon); Txt_News_Empty = (TextView)FindViewById(Resource.Id.Txt_LabelEmpty); Txt_News_start = (TextView)FindViewById(Resource.Id.Txt_LabelStart); Btn_Reload = (Button)FindViewById(Resource.Id.reloadPage_Button); IMethods.Set_TextViewIcon("2", News_Icon, "\uf119"); News_Empty.Visibility = ViewStates.Gone; swipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight); swipeRefreshLayout.Refreshing = true; swipeRefreshLayout.Enabled = true; //Set WebView and Load url to be rendered on WebView HyberdPostViewer_Load(); } catch (Exception e) { Crashes.TrackError(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { if ((int)Build.VERSION.SdkInt >= 23) { Window.AddFlags(WindowManagerFlags.LayoutNoLimits); Window.AddFlags(WindowManagerFlags.TranslucentNavigation); } base.OnCreate(savedInstanceState); IMethods.IApp.FullScreenApp(this); var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.EventView_Layout); if (view != null) { SetContentView(view); } else { SetContentView(Resource.Layout.EventView_Layout); } News_Empty = (LinearLayout)FindViewById(Resource.Id.News_LinerEmpty); News_Icon = (TextView)FindViewById(Resource.Id.News_icon); Txt_News_Empty = (TextView)FindViewById(Resource.Id.Txt_LabelEmpty); Txt_News_start = (TextView)FindViewById(Resource.Id.Txt_LabelStart); Btn_Reload = (Button)FindViewById(Resource.Id.reloadPage_Button); IMethods.Set_TextViewIcon("2", News_Icon, "\uf119"); News_Empty.Visibility = ViewStates.Gone; Txt_Name = FindViewById <TextView>(Resource.Id.tvName_ptwo); IconGoing = FindViewById <TextView>(Resource.Id.IconGoing); Txt_Going = FindViewById <TextView>(Resource.Id.GoingTextview); IconInterested = FindViewById <TextView>(Resource.Id.IconInterested); Txt_Interested = FindViewById <TextView>(Resource.Id.InterestedTextview); Txt_StartDate = FindViewById <TextView>(Resource.Id.txtStartDate); Txt_EndDate = FindViewById <TextView>(Resource.Id.txtEndDate); IconLocation = FindViewById <TextView>(Resource.Id.IconLocation); Txt_Location = FindViewById <TextView>(Resource.Id.LocationTextview); Txt_Description = FindViewById <TextView>(Resource.Id.tv_aboutdescUser); HybirdView = (WebView)FindViewById(Resource.Id.hybirdview); ImageEventCover = FindViewById <ImageViewAsync>(Resource.Id.EventCover); IconBack = FindViewById <ImageView>(Resource.Id.back); Btn_Go = FindViewById <Button>(Resource.Id.ButtonGoing); Btn_Intersted = FindViewById <Button>(Resource.Id.ButtonIntersted); FloatingActionButtonView = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButtonView); IMethods.Set_TextViewIcon("1", IconGoing, IonIcons_Fonts.IosPeople); IMethods.Set_TextViewIcon("1", IconInterested, IonIcons_Fonts.AndroidStar); IMethods.Set_TextViewIcon("1", IconLocation, IonIcons_Fonts.Location); var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); mapFragment.GetMapAsync(this); //Set to event id to load the news feed HybridController = new HybirdViewController(this, HybirdView, null); Get_Data_Event(); } catch (Exception e) { Crashes.TrackError(e); } }