Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a lot of stuff to the Android prototype, too long to list. See …
…checked-in files. Related to issue #406. git-svn-id: http://hamster-svn/svn/repos/base@686 765c1f7c-9fb8-954f-9ff8-dd0915cb3117
- Loading branch information
animal
committed
Jan 24, 2013
1 parent
c749f9d
commit 9193f85
Showing
24 changed files
with
1,036 additions
and
39 deletions.
There are no files selected for viewing
62 changes: 54 additions & 8 deletions
62
MPfm/branches/current/MPfm.Android/Classes/Activities/MainActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
MPfm/branches/current/MPfm.Android/Classes/Activities/SplashActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Android.App; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
|
||
namespace MPfm.Android | ||
{ | ||
[Activity(MainLauncher = true, NoHistory = true, ScreenOrientation = ScreenOrientation.Portrait, Theme = "@style/Theme.Splash")] | ||
public class SplashActivity : Activity | ||
{ | ||
//TextView textViewStatus; | ||
|
||
public SplashActivity() | ||
{ | ||
} | ||
|
||
protected override void OnCreate(Bundle bundle) | ||
{ | ||
base.OnCreate(bundle); | ||
|
||
//SetContentView(Resource.Layout.Splash); | ||
//textViewStatus = FindViewById<TextView>(Resource.Id.textViewStatus); | ||
|
||
StartActivity(typeof(MainActivity)); | ||
} | ||
|
||
//public void ShowError(Exception ex) | ||
//{ | ||
// RunOnUiThread(() => | ||
// { | ||
// textViewStatus.Text = "Error: " + ex.Message; | ||
// }); | ||
//} | ||
|
||
//public void RefreshMessage(string message) | ||
//{ | ||
// RunOnUiThread(() => | ||
// { | ||
// textViewStatus.Text = message; | ||
// }); | ||
//} | ||
|
||
//public void InitializeDone() | ||
//{ | ||
// RunOnUiThread(() => | ||
// { | ||
// textViewStatus.Text = "Chargement complet."; | ||
// StartActivity(typeof(MainActivity)); | ||
// }); | ||
//} | ||
} | ||
} | ||
|
62 changes: 62 additions & 0 deletions
62
MPfm/branches/current/MPfm.Android/Classes/Adapters/GenericListAdapter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Collections.Generic; | ||
using Android.App; | ||
using Android.Graphics; | ||
using Android.Views; | ||
using Android.Widget; | ||
using MPfm.Android.Classes.Objects; | ||
|
||
namespace MPfm.Android.Classes.Adapters | ||
{ | ||
public class GenericListAdapter : BaseAdapter<GenericListItem> | ||
{ | ||
readonly Activity _context; | ||
readonly IList<GenericListItem> _items; | ||
|
||
public GenericListAdapter(Activity context, IList<GenericListItem> items) | ||
{ | ||
this._context = context; | ||
this._items = items; | ||
} | ||
|
||
public override long GetItemId(int position) | ||
{ | ||
return position; | ||
} | ||
|
||
public override GenericListItem this[int position] | ||
{ | ||
get { return _items[position]; } | ||
} | ||
|
||
public override int Count | ||
{ | ||
get { return _items.Count; } | ||
} | ||
|
||
public override View GetView(int position, View convertView, ViewGroup parent) | ||
{ | ||
var item = _items[position]; | ||
View view = convertView; | ||
if (view == null) // no view to re-use, create new | ||
view = _context.LayoutInflater.Inflate(Resource.Layout.GenericCell, null); | ||
|
||
//view.SetBackgroundColor(Color.White); | ||
|
||
var title = view.FindViewById<TextView>(Resource.Id.genericcell_title); | ||
title.Text = _items[position].Title; | ||
|
||
var image = view.FindViewById<ImageView>(Resource.Id.genericcell_image); | ||
image.SetBackgroundColor(Color.White); | ||
|
||
//// Check channel and load correct image | ||
//if (_items[position].Id == 47) | ||
// image.SetImageDrawable(_context.Resources.GetDrawable(global::Android.Resource.Drawable.channels_pc)); | ||
//else if (_items[position].Id == 67) | ||
// image.SetImageDrawable(_context.Resources.GetDrawable(global::Android.Resource.Drawable.channels_em)); | ||
//else | ||
// image.SetImageDrawable(_context.Resources.GetDrawable(global::Android.Resource.Drawable.channels_bap)); | ||
|
||
return view; | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
MPfm/branches/current/MPfm.Android/Classes/Adapters/TabPagerAdapter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using Android.App; | ||
using Android.Runtime; | ||
using Android.Support.V13.App; | ||
using Android.Support.V4.View; | ||
using Android.Views; | ||
using Android.Widget; | ||
using MPfm.Android.Classes.Fragments; | ||
using MPfm.Android.Classes.Objects; | ||
|
||
namespace MPfm.Android.Classes.Adapters | ||
{ | ||
public class TabPagerAdapter : FragmentPagerAdapter, ActionBar.ITabListener, ViewPager.IOnPageChangeListener | ||
{ | ||
private ViewPager _viewPager; | ||
private ActionBar _actionBar; | ||
|
||
public TabPagerAdapter(IntPtr javaReference, JniHandleOwnership transfer) | ||
: base(javaReference, transfer) | ||
{ | ||
} | ||
|
||
public TabPagerAdapter(FragmentManager fm, ViewPager viewPager, ActionBar actionBar) | ||
: base(fm) | ||
{ | ||
_viewPager = viewPager; | ||
_actionBar = actionBar; | ||
} | ||
|
||
public void OnTabReselected(ActionBar.Tab tab, FragmentTransaction ft) | ||
{ | ||
} | ||
|
||
public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft) | ||
{ | ||
_viewPager.SetCurrentItem(tab.Position, true); | ||
} | ||
|
||
public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) | ||
{ | ||
} | ||
|
||
public override Fragment GetItem(int p0) | ||
{ | ||
return new GenericListFragment(); | ||
} | ||
|
||
public override int Count | ||
{ | ||
get { return 5; } | ||
} | ||
|
||
public void OnPageScrollStateChanged(int p0) | ||
{ | ||
} | ||
|
||
public void OnPageScrolled(int p0, float p1, int p2) | ||
{ | ||
} | ||
|
||
public void OnPageSelected(int position) | ||
{ | ||
_actionBar.SetSelectedNavigationItem(position); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.