Skip to content

Commit

Permalink
Android: Updated project after changes on other platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
ycastonguay committed Nov 20, 2013
1 parent 8f0a9ed commit 97794da
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 24 deletions.
12 changes: 6 additions & 6 deletions MPfm/MPfm.Android/Classes/Activities/MainActivity.cs
Expand Up @@ -60,7 +60,7 @@ public class MainActivity : BaseActivity, View.IOnTouchListener, ActionBar.IOnNa
private ViewFlipper _viewFlipper;
private LinearLayout _miniPlayer;
private LinearLayout _miniPlaylist;
private List<KeyValuePair<MobileOptionsMenuType, string>> _options;
private List<MobileOptionsMenuEntity> _options;
private TextView _lblArtistName;
private TextView _lblAlbumTitle;
private TextView _lblSongTitle;
Expand Down Expand Up @@ -255,8 +255,8 @@ public override bool OnCreateOptionsMenu(IMenu menu)
//spannableString.SetSpan(new ForegroundColorSpan(Color.White), 0, spannableString.Length(), 0);
//var menuItem = menu.Add(spannableString);

var menuItem = menu.Add(option.Value);
switch (option.Key)
var menuItem = menu.Add(option.Title);
switch (option.MenuType)
{
case MobileOptionsMenuType.About:
//menuItem.SetShowAsAction(ShowAsAction.Never);
Expand Down Expand Up @@ -294,8 +294,8 @@ public override bool OnCreateOptionsMenu(IMenu menu)

public override bool OnOptionsItemSelected(IMenuItem menuItem)
{
var option = _options.FirstOrDefault(x => x.Value == menuItem.TitleFormatted.ToString());
OnItemClick(option.Key);
var option = _options.FirstOrDefault(x => x.Title == menuItem.TitleFormatted.ToString());
OnItemClick(option.MenuType);
return base.OnOptionsItemSelected(menuItem);
}

Expand Down Expand Up @@ -430,7 +430,7 @@ public void AddTab(MobileNavigationTabType type, string title, MobileLibraryBrow
#region IMobileOptionsMenuView implementation

public Action<MobileOptionsMenuType> OnItemClick { get; set; }
public void RefreshMenu(List<KeyValuePair<MobileOptionsMenuType, string>> options)
public void RefreshMenu(List<MobileOptionsMenuEntity> options)
{
Console.WriteLine("MainActivity - RefreshMenu");
_options = options;
Expand Down
13 changes: 9 additions & 4 deletions MPfm/MPfm.Android/Classes/Activities/ResumePlaybackActivity.cs
Expand Up @@ -29,6 +29,7 @@
using MPfm.Android.Classes.Navigation;
using MPfm.Library.Objects;
using MPfm.MVP.Bootstrap;
using MPfm.MVP.Models;
using MPfm.MVP.Navigation;
using MPfm.MVP.Views;
using MPfm.Player.Objects;
Expand All @@ -41,7 +42,7 @@ public class ResumePlaybackActivity : BaseActivity, IResumePlaybackView
private MobileNavigationManager _navigationManager;
private ListView _listView;
private ResumePlaybackListAdapter _listAdapter;
private List<CloudDeviceInfo> _devices;
private List<ResumePlaybackEntity> _devices;

protected override void OnCreate(Bundle bundle)
{
Expand All @@ -54,7 +55,7 @@ protected override void OnCreate(Bundle bundle)
ActionBar.SetHomeButtonEnabled(true);

_listView = FindViewById<ListView>(Resource.Id.resumePlayback_listView);
_listAdapter = new ResumePlaybackListAdapter(this, new List<CloudDeviceInfo>());
_listAdapter = new ResumePlaybackListAdapter(this, new List<ResumePlaybackEntity>());
_listView.SetAdapter(_listAdapter);
_listView.ItemClick += ListViewOnItemClick;

Expand Down Expand Up @@ -123,7 +124,7 @@ public override bool OnOptionsItemSelected(IMenuItem item)

#region IResumePlaybackView implementation

public Action<CloudDeviceInfo> OnResumePlayback { get; set; }
public Action<ResumePlaybackEntity> OnResumePlayback { get; set; }
public Action OnOpenPreferencesView { get; set; }
public Action OnCheckCloudLoginStatus { get; set; }

Expand All @@ -132,11 +133,15 @@ public void ResumePlaybackError(Exception ex)
ShowErrorDialog(ex);
}

public void AudioFilesNotFoundError(string title, string message)
{
}

public void RefreshAppLinkedStatus(bool isAppLinked)
{
}

public void RefreshDevices(IEnumerable<CloudDeviceInfo> devices)
public void RefreshDevices(IEnumerable<ResumePlaybackEntity> devices)
{
RunOnUiThread(() =>
{
Expand Down
21 changes: 11 additions & 10 deletions MPfm/MPfm.Android/Classes/Adapters/ResumePlaybackListAdapter.cs
Expand Up @@ -23,22 +23,23 @@
using Android.Widget;
using MPfm.Core;
using MPfm.Library.Objects;
using MPfm.MVP.Models;
using MPfm.Player.Objects;

namespace MPfm.Android.Classes.Adapters
{
public class ResumePlaybackListAdapter : BaseAdapter<CloudDeviceInfo>
public class ResumePlaybackListAdapter : BaseAdapter<ResumePlaybackEntity>
{
readonly Activity _context;
List<CloudDeviceInfo> _items;
List<ResumePlaybackEntity> _items;

public ResumePlaybackListAdapter(Activity context, List<CloudDeviceInfo> items)
public ResumePlaybackListAdapter(Activity context, List<ResumePlaybackEntity> items)
{
_context = context;
_items = items;
}

public void SetData(IEnumerable<CloudDeviceInfo> items)
public void SetData(IEnumerable<ResumePlaybackEntity> items)
{
_items = items.ToList();
NotifyDataSetChanged();
Expand All @@ -49,7 +50,7 @@ public override long GetItemId(int position)
return position;
}

public override CloudDeviceInfo this[int position]
public override ResumePlaybackEntity this[int position]
{
get { return _items[position]; }
}
Expand All @@ -74,12 +75,12 @@ public override View GetView(int position, View convertView, ViewGroup parent)
var lblTimestamp = view.FindViewById<TextView>(Resource.Id.resumePlaybackCell_lblTimestamp);
var imageAlbum = view.FindViewById<ImageView>(Resource.Id.resumePlaybackCell_imageAlbum);

lblTitle.Text = item.DeviceName;
lblTitle.Text = item.DeviceInfo.DeviceName;
lblSubtitle.Text = "On-the-fly playlist";
lblArtistName.Text = item.ArtistName;
lblAlbumTitle.Text = item.AlbumTitle;
lblSongTitle.Text = item.SongTitle;
lblTimestamp.Text = string.Format("Last updated on {0}", item.Timestamp);
lblArtistName.Text = item.DeviceInfo.ArtistName;
lblAlbumTitle.Text = item.DeviceInfo.AlbumTitle;
lblSongTitle.Text = item.DeviceInfo.SongTitle;
lblTimestamp.Text = string.Format("Last updated on {0}", item.DeviceInfo.Timestamp);

return view;
}
Expand Down
Expand Up @@ -42,6 +42,7 @@ public class AndroidDropboxService : Java.Lang.Object, ICloudLibraryService, Dbx
private DbxFileSystem _fileSystem;

public event CloudAuthenticationStatusChanged OnCloudAuthenticationStatusChanged;
public event CloudAuthenticationFailed OnCloudAuthenticationFailed;
public event CloudDataChanged OnCloudDataChanged;

public bool HasLinkedAccount
Expand Down
5 changes: 4 additions & 1 deletion MPfm/MPfm.Android/MPfm.Android.csproj
Expand Up @@ -46,7 +46,10 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidLinkMode>None</AndroidLinkMode>
<AndroidLinkSkip />
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<BundleAssemblies>False</BundleAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dropbox.Android, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion MPfm/MPfm.Android/Properties/AndroidManifest.xml
Expand Up @@ -12,7 +12,7 @@
<activity android:name="com.dropbox.client2.android.AuthActivity" android:launchMode="singleTask">
<intent-filter>
<!--<data android:scheme="db-6tc6565743i743n" />-->
<data android:scheme="db-m1bcpax276elhfi" />
<data android:scheme="db-m1bcpax276elhfi" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
2 changes: 1 addition & 1 deletion MPfm/MPfm.Android/Resources/xml/preferences_cloud.xml
Expand Up @@ -11,7 +11,7 @@
android:key="dropbox_login" />
<CheckBoxPreference
android:key="dropbox_resume_playback_enabled"
android:title="Enable Resume Playback with Dropbox"
android:title="Enable Resume Playback"
android:icon="@drawable/actionbar_resume"
android:summary="Note: This will take a small amount of bandwidth (about 1 kilobyte) every time the player switches to a new song."
android:defaultValue="true" />
Expand Down
2 changes: 2 additions & 0 deletions MPfm/MPfm.MVP/MPfm.MVP.Android.csproj
Expand Up @@ -153,7 +153,9 @@
<Compile Include="Models\CloudConnectEntity.cs" />
<Compile Include="Models\CloudPreferencesStateEntity.cs" />
<Compile Include="Models\FolderEntity.cs" />
<Compile Include="Models\MobileOptionsMenuEntity.cs" />
<Compile Include="Models\PlaylistEntity.cs" />
<Compile Include="Models\ResumePlaybackEntity.cs" />
<Compile Include="Navigation\INavigationManager.cs" />
<Compile Include="Navigation\MobileNavigationManager.cs" />
<Compile Include="Presenters\AudioPreferencesPresenter.cs" />
Expand Down
2 changes: 1 addition & 1 deletion MPfm/MPfm.MVP/Presenters/MobileOptionsMenuPresenter.cs
Expand Up @@ -99,7 +99,7 @@ private void Initialize()
HeaderTitle = "Preferences",
MenuType = MobileOptionsMenuType.LibraryPreferences
});
#elif
#else
_items.Add(new MobileOptionsMenuEntity() {
Title = "Preferences",
HeaderTitle = "Other",
Expand Down

0 comments on commit 97794da

Please sign in to comment.