Skip to content

Commit

Permalink
Android: Bug fixes with SyncMenu and EqualizerPresetDetails after cha…
Browse files Browse the repository at this point in the history
…nges on MobileNavigationManager.
  • Loading branch information
ycastonguay committed Nov 2, 2013
1 parent 2259cc1 commit a9dee4c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
Expand Up @@ -36,7 +36,7 @@ namespace MPfm.Android
[Activity(Label = "Equalizer Preset Details", ScreenOrientation = ScreenOrientation.Sensor, Theme = "@style/MyAppTheme", ConfigurationChanges = ConfigChanges.KeyboardHidden | ConfigChanges.Orientation | ConfigChanges.ScreenSize, WindowSoftInputMode = SoftInput.StateHidden)]
public class EqualizerPresetDetailsActivity : BaseActivity, IEqualizerPresetDetailsView, EditText.IOnEditorActionListener
{
private MobileNavigationManager _navigationManager;
private string _presetId;
private string _sourceActivityType;
private EqualizerPresetFadersListAdapter _listAdapter;
private ListView _listView;
Expand All @@ -51,7 +51,6 @@ protected override void OnCreate(Bundle bundle)
Console.WriteLine("EqualizerPresetDetailsActivity - OnCreate");
base.OnCreate(bundle);

_navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
SetContentView(Resource.Layout.EqualizerPresetDetails);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
Expand All @@ -71,9 +70,10 @@ protected override void OnCreate(Bundle bundle)

// Save the source activity type for later (for providing Up navigation)
_sourceActivityType = Intent.GetStringExtra("sourceActivity");
_presetId = Intent.GetStringExtra("presetId");

// Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
//((AndroidNavigationManager)_navigationManager).SetEqualizerPresetDetailsActivityInstance(this);
var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
navigationManager.BindEqualizerPresetDetailsView(null, this, new Guid(_presetId));
}

protected override void OnStart()
Expand Down
30 changes: 16 additions & 14 deletions MPfm/MPfm.Android/Classes/Activities/SyncMenuActivity.cs
Expand Up @@ -34,29 +34,29 @@
using MPfm.MVP.Views;
using MPfm.Player.Objects;
using MPfm.Sound.AudioFiles;
using Newtonsoft.Json;

namespace MPfm.Android
{
[Activity(Label = "Sync Menu", ScreenOrientation = ScreenOrientation.Sensor, Theme = "@style/MyAppTheme", ConfigurationChanges = ConfigChanges.KeyboardHidden | ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
public class SyncMenuActivity : BaseActivity, ISyncMenuView
{
private MobileNavigationManager _navigationManager;
LinearLayout _loadingLayout;
LinearLayout _mainLayout;
TextView _lblStatus;
TextView _lblTotal;
TextView _lblFreeSpace;
Button _btnSelectAll;
ListView _listView;
SyncMenuListAdapter _listAdapter;
List<SyncMenuItemEntity> _items;
private SyncDevice _device;
private LinearLayout _loadingLayout;
private LinearLayout _mainLayout;
private TextView _lblStatus;
private TextView _lblTotal;
private TextView _lblFreeSpace;
private Button _btnSelectAll;
private ListView _listView;
private SyncMenuListAdapter _listAdapter;
private List<SyncMenuItemEntity> _items;

protected override void OnCreate(Bundle bundle)
{
Console.WriteLine("SyncMenuActivity - OnCreate");
base.OnCreate(bundle);

_navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
SetContentView(Resource.Layout.SyncMenu);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
Expand All @@ -75,9 +75,11 @@ protected override void OnCreate(Bundle bundle)
_listView.ItemClick += ListViewOnItemClick;
_listView.ItemLongClick += ListViewOnItemLongClick;

// Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
//((AndroidNavigationManager)_navigationManager).SetSyncMenuActivityInstance(this);
//_navigationManager.BindSyncMenuView(this, null);
string json = Intent.GetStringExtra("device");
_device = JsonConvert.DeserializeObject<SyncDevice>(json);

var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
navigationManager.BindSyncMenuView(this, _device);
}

private void ListViewOnItemClick(object sender, AdapterView.ItemClickEventArgs itemClickEventArgs)
Expand Down
Expand Up @@ -28,6 +28,7 @@
using MPfm.MVP.Presenters.Interfaces;
using MPfm.MVP.Views;
using MPfm.Sound.AudioFiles;
using Newtonsoft.Json;
using TinyMessenger;

namespace MPfm.Android.Classes.Navigation
Expand Down Expand Up @@ -59,6 +60,11 @@ public AndroidNavigationManager(ITinyMessengerHub messageHub)
});
}

public override void PushTabView(MobileNavigationTabType type, IBaseView view)
{
// Not used on Android
}

public override void PushDialogView(MobileDialogPresentationType presentationType, string viewTitle, IBaseView sourceView, IBaseView view)
{
MainActivity.PushDialogView(viewTitle, sourceView, view);
Expand Down Expand Up @@ -153,6 +159,8 @@ public override void CreateSyncView()
public override void CreateSyncMenuView(SyncDevice device)
{
var intent = new Intent(MainActivity, typeof(SyncMenuActivity));
string json = JsonConvert.SerializeObject(device);
intent.PutExtra("device", json);
MainActivity.StartActivity(intent);
}

Expand Down
18 changes: 9 additions & 9 deletions MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs
Expand Up @@ -400,15 +400,15 @@ public virtual void BindPreferencesView(IPreferencesView view)
_preferencesPresenter = Bootstrapper.GetContainer().Resolve<IPreferencesPresenter>();
_preferencesPresenter.BindView(view);

#if ANDROID
// On Android, push subviews for preferences since there's generally more space on screen and swiping horizontally is more natural.
var general = CreateGeneralPreferencesView();
var audio = CreateAudioPreferencesView();
var library = CreateLibraryPreferencesView();
_preferencesView.PushSubView(general);
_preferencesView.PushSubView(audio);
_preferencesView.PushSubView(library);
#endif
//#if ANDROID
// // On Android, push subviews for preferences since there's generally more space on screen and swiping horizontally is more natural.
// var general = CreateGeneralPreferencesView();
// var audio = CreateAudioPreferencesView();
// var library = CreateLibraryPreferencesView();
// _preferencesView.PushSubView(general);
// _preferencesView.PushSubView(audio);
// _preferencesView.PushSubView(library);
//#endif
}

public virtual void CreateAudioPreferencesView()
Expand Down

0 comments on commit a9dee4c

Please sign in to comment.