Skip to content

Instantly share code, notes, and snippets.

@hieumoscow
Created May 26, 2016 00:32
Show Gist options
  • Save hieumoscow/ef2763d9eb25e3dedaa525b1267df23f to your computer and use it in GitHub Desktop.
Save hieumoscow/ef2763d9eb25e3dedaa525b1267df23f to your computer and use it in GitHub Desktop.
using Android.App;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Support.V4.View;
using Android.Graphics;
namespace Clock
{
[Activity(Label = "Clock", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Android.Support.V4.App.FragmentActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var fragments = new Android.Support.V4.App.Fragment[]
{
new TimeFragment (),
new StopwatchFragment(),
new AboutFragment ()
};
var titles = CharSequence.ArrayFromStringArray(new []
{
"\uf000 Time",
"Stopwatch",
"About"
});
//
// TODO: Use FindViewById to get a reference to the ViewPager in the UI
//
var viewPager = FindViewById<ViewPager>(Resource.Id.viewPager);
//
// TODO: Create a ClockAdapter
//
var clockAdapter = new ClockAdapter (SupportFragmentManager, fragments, titles);
//
// TODO: Assign the ClockAdapter to the ViewPager's Adapter property
//
viewPager.Adapter = clockAdapter;
var tabStrip = FindViewById<PagerTabStrip>(Resource.Id.pagerTabStrip);
Typeface font = Typeface.CreateFromAsset (this.ApplicationContext.Assets, "FontAwesome.ttf");
for (int i = 0; i < tabStrip.ChildCount; ++i) {
View nextChild = tabStrip.GetChildAt(i);
if (nextChild is TextView) {
TextView textViewToConvert = (TextView) nextChild;
textViewToConvert.Typeface = font;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment