-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android: Added list adapter for equalizer presets; can now select, ad…
…d and edit presets. Related to issue #406.
- Loading branch information
1 parent
e8d377a
commit cc140c2
Showing
7 changed files
with
374 additions
and
232 deletions.
There are no files selected for viewing
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
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
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
82 changes: 82 additions & 0 deletions
82
MPfm/MPfm.Android/Classes/Adapters/EqualizerPresetsListAdapter.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,82 @@ | ||
// Copyright © 2011-2013 Yanick Castonguay | ||
// | ||
// This file is part of MPfm. | ||
// | ||
// MPfm is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// MPfm is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with MPfm. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Android.App; | ||
using Android.Graphics; | ||
using Android.Views; | ||
using Android.Widget; | ||
using MPfm.Core; | ||
using MPfm.Player.Objects; | ||
|
||
namespace MPfm.Android.Classes.Adapters | ||
{ | ||
public class EqualizerPresetsListAdapter : BaseAdapter<EQPreset> | ||
{ | ||
private readonly EqualizerPresetsActivity _context; | ||
private List<EQPreset> _presets; | ||
|
||
public bool HasPresetChanged { get; private set; } | ||
|
||
public EqualizerPresetsListAdapter(EqualizerPresetsActivity context, List<EQPreset> presets) | ||
{ | ||
_context = context; | ||
_presets = presets; | ||
} | ||
|
||
public void SetData(List<EQPreset> presets) | ||
{ | ||
_presets = presets; | ||
NotifyDataSetChanged(); | ||
} | ||
|
||
public void SetSelected(Guid presetId) | ||
{ | ||
|
||
} | ||
|
||
public override long GetItemId(int position) | ||
{ | ||
return position; | ||
} | ||
|
||
public override EQPreset this[int position] | ||
{ | ||
get { return _presets[position]; } | ||
} | ||
|
||
public override int Count | ||
{ | ||
get { return _presets.Count; } | ||
} | ||
|
||
public override View GetView(int position, View convertView, ViewGroup parent) | ||
{ | ||
var item = _presets[position]; | ||
View view = convertView; | ||
if (view == null) // no view to re-use, create new | ||
view = _context.LayoutInflater.Inflate(Resource.Layout.EqualizerPresetCell, null); | ||
|
||
var lblName = view.FindViewById<TextView>(Resource.Id.equalizerPresetCell_lblName); | ||
lblName.Text = _presets[position].Name; | ||
|
||
return view; | ||
} | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
MPfm/MPfm.Android/Resources/Layout/EqualizerPresetCell.axml
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,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="fill_parent" | ||
android:layout_height="56dp" | ||
android:padding="8dp" | ||
android:gravity="center_vertical" | ||
android:orientation="horizontal"> | ||
<TextView | ||
android:id="@+id/equalizerPresetCell_lblName" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="left" | ||
android:text="Default" | ||
android:textColor="#000000" | ||
android:textSize="14dp" /> | ||
</LinearLayout> |
Oops, something went wrong.