-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainActivity.cs
140 lines (100 loc) · 4.5 KB
/
MainActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* App by:
.__ .___
| |__ ____ ___ ________ ____ ____ __| _/
| | \_/ __ \\ \/ /\__ \ / ___\ / _ \ / __ |
| Y \ ___/ > < / __ \_/ /_/ > <_> ) /_/ |
|___| /\___ >__/\_ \(____ /\___ / \____/\____ |
\/ \/ \/ \//_____/ \/
bitchute.com/channel/hexagod
soundcloud.com/vybemasterz
twitter @vybeypantelonez
minds @hexagod
steemit @vybemasterz
gab.ai @hexagod
*/
namespace com.xamarin.example.BitChute
{
using System;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Graphics.Drawables;
using Android.OS;
using Android.Widget;
using Android.Webkit;
using static Android.Widget.TabHost;
using static Android.Views.View;
using Android.Views;
using com.xamarin.example.BitChute.Activities;
// using BackgroundStreamingAudio.Services;
[Activity(Label = "@string/BitChute", MainLauncher = true, Icon = "@drawable/ic_launcher",
ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
#pragma warning disable CS0618 // Type or member is obsolete
public class MainActivity : TabActivity
#pragma warning restore CS0618 // Type or member is obsolete, << no u!
{
private void CreateTab(Type activityType, string tag, string label)
{
var intent = new Intent(this, activityType);
intent.AddFlags(ActivityFlags.NewTask);
var spec = TabHost.NewTabSpec(tag);
spec.SetIndicator(label);
spec.SetContent(intent);
TabHost.AddTab(spec);
}
protected override void OnCreate(Bundle bundle)
{
//bundle
base.OnCreate(bundle);
//set the view
SetContentView(Resource.Layout.Main);
TabHost tabHost = FindViewById<TabHost>(Android.Resource.Id.TabHost);
tabHost.Setup();
tabHost.SetBackgroundColor(Android.Graphics.Color.Black);
ActionBar.Hide();
//specify tabs
CreateTab(typeof(WhatsOnActivity), "whats_on", "What's On");
CreateTab(typeof(SubsActivity), "speakers", "Subs");
CreateTab(typeof(PlaylistActivity), "sessions", "Play-lists");
CreateTab(typeof(MyChannelActivity), "my_schedule", "My Channel");
CreateTab(typeof(SettingsActivity), "settings", "Settings");
tabHost.TabWidget.GetChildAt(0).SetOnClickListener(new WhatsOnClickListener(tabHost));
tabHost.TabWidget.GetChildAt(1).SetOnClickListener(new SubsClickListener(tabHost));
tabHost.TabWidget.GetChildAt(2).SetOnClickListener(new PlaylistClickListener(tabHost));
tabHost.TabWidget.GetChildAt(3).SetOnClickListener(new MyChannelClickListener(tabHost));
tabHost.TabWidget.GetChildAt(4).SetOnClickListener(new SettingsClickListener(tabHost));
}
}
//what's on
[Activity]
//this class should be an aggregate subscription feed
public class WhatsOnActivity : Activity
{
public override void OnBackPressed()
{
WebView whatsOnWebView = FindViewById<WebView>(Resource.Id.webViewWhatsOn);
whatsOnWebView.GoBack();
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.whatsOn);
//declare webview and tell our code where to find the XAML resource
WebView whatsOnWebView = FindViewById<WebView>(Resource.Id.webViewWhatsOn);
whatsOnWebView.SetBackgroundColor(Android.Graphics.Color.Green);
//set the webview client
whatsOnWebView.SetWebViewClient(new WebViewClient());
//load the 'whats on' url, will need webscript for curated subscribed feed
whatsOnWebView.LoadUrl("https://www.bitchute.com/#listing-subscribed");
//enable javascript in our webview
whatsOnWebView.Settings.JavaScriptEnabled = true;
//zoom control on? This should perhaps be disabled for consistency?
//we will leave it on for now
whatsOnWebView.Settings.BuiltInZoomControls = true;
whatsOnWebView.Settings.SetSupportZoom(true);
//scrollbarsdisabled
// subWebView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
whatsOnWebView.ScrollbarFadingEnabled = false;
}
}
}