-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Mobile | Settings page issues (#932)
- Loading branch information
1 parent
b7d2721
commit 6379c01
Showing
3 changed files
with
77 additions
and
1 deletion.
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
63 changes: 63 additions & 0 deletions
63
src/MobileUI/Platforms/Android/Renderers/CustomTableViewRenderer.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,63 @@ | ||
using Android.Content; | ||
using Android.Graphics.Drawables; | ||
using Android.Views; | ||
using Android.Widget; | ||
using Microsoft.Maui.Controls.Compatibility.Platform.Android; | ||
using Microsoft.Maui.Controls.Platform; | ||
using TableViewModelRenderer = Microsoft.Maui.Controls.Handlers.Compatibility.TableViewModelRenderer; | ||
using TableViewRenderer = Microsoft.Maui.Controls.Handlers.Compatibility.TableViewRenderer; | ||
|
||
namespace SSW.Rewards.Mobile.Renderers; | ||
|
||
public class CustomTableViewRenderer : TableViewRenderer | ||
{ | ||
public CustomTableViewRenderer(Context context) : base(context) | ||
{ | ||
} | ||
|
||
protected override void OnElementChanged(ElementChangedEventArgs<TableView> e) | ||
{ | ||
base.OnElementChanged(e); | ||
if (Control == null) | ||
return; | ||
|
||
var listView = Control as Android.Widget.ListView; | ||
listView.Divider = new ColorDrawable(Colors.Transparent.ToAndroid()); | ||
} | ||
|
||
protected override TableViewModelRenderer GetModelRenderer(Android.Widget.ListView listView, TableView view) | ||
{ | ||
return new CustomHeaderTableViewModelRenderer(Context, listView, view); | ||
} | ||
|
||
private class CustomHeaderTableViewModelRenderer : TableViewModelRenderer | ||
{ | ||
public CustomHeaderTableViewModelRenderer(Context context, Android.Widget.ListView listView, TableView view) : | ||
base(context, listView, view) | ||
{ | ||
} | ||
|
||
public override Android.Views.View GetView(int position, Android.Views.View convertView, ViewGroup parent) | ||
{ | ||
var view = base.GetView(position, convertView, parent); | ||
|
||
var element = GetCellForPosition(position); | ||
|
||
// section header will be a TextCell | ||
if (element.GetType() == typeof(TextCell)) | ||
{ | ||
try | ||
{ | ||
// get the divider below the header | ||
var divider = (view as LinearLayout).GetChildAt(1); | ||
|
||
// Set the color | ||
divider.SetBackgroundColor(Colors.Transparent.ToAndroid()); | ||
} | ||
catch (Exception) { } | ||
} | ||
|
||
return view; | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/MobileUI/Platforms/iOS/Renderers/CustomTableViewRenderer.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,8 @@ | ||
using Microsoft.Maui.Controls.Handlers.Compatibility; | ||
|
||
namespace SSW.Rewards.Mobile.Renderers; | ||
|
||
public class CustomTableViewRenderer : TableViewRenderer | ||
{ | ||
|
||
} |