Closed ChaseFlorell closed 2 years ago
Hi @ChaseFlorell,
I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.
Well I took a stab at tinting your image and it seems to work. For anyone else...
public class CustomFingerprintDialogFragment : FingerprintDialogFragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view=base.OnCreateView(inflater, container, savedInstanceState);
var image = view.FindViewById<ImageView>(Resource.Id.fingerprint_imgFingerprint);
image.SetColorFilter(Color.ParseColor("#000000")); // black
return view;
}
}
I know we can create a custom Fragment, but I'm not sure how that works within your plugin.
See the documentation: https://github.com/smstuebe/xamarin-fingerprint#configuration
public class MyCustomDialogFragment : FingerprintDialogFragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = base.OnCreateView(inflater, container, savedInstanceState);
var image = view.FindViewById<ImageView>(Resource.Id.fingerprint_imgFingerprint);
image.SetImageResource(Resource.Drawable.fingerprint_black);
return view;
}
}
Unfortunately, the fragment is calling ClearColorFilter()
after each animation. That's why you have to add a black copy of the icon to your project.
I'll change the code, so you will be able to set a tint for the icon in the next release.
That would be pretty cool @smstuebe. For now my workaround will do just fine.
Sure? have you tested a negative try where the icon turns red and then back to white? I'd be suprised, if it turns back to black.
Btw: don't close it. It contains a new feature request ^^
ah, you are right. If I scan the correct finger, it goes green then disappears (thats what I tested). When I use the incorrect finger, it goes red then goes white.
Not sure I can submit a PR, but here's my thought.
private async Task AnimateFailedTryAsync()
{
if (_icon == null)
return;
var originalColorFilter = _icon.ColorFilter;
_icon.SetColorFilter(NegativeColor);
var shake = ObjectAnimator.OfFloat(_icon, "translationX", -10f, 10f);
shake.SetDuration(500);
shake.SetInterpolator(new CycleInterpolator(5));
await shake.StartAsync();
_icon.SetColorFilter(originalColorFilter);
}
I'll make it completely customizable like NegativeColor. Or better: I may add a styling mechanism, so you don't have to create a custom just class for styling.
Hey guys, was this fixed? I'm having a hard time on my app with the white on white...
oupsi, no. I'll move it to Milestone 1.4.6.
As of now there is a way that I can apply my own FingerprintCustomDialog.axml? If I do that in the OnCreateView it will lose the bindings even if I use the same resource ids that you use in your .axml file.
@smstuebe any update on this?
-> 1.4.6
You can set DefaultColor
in a custom dialog now.
@smstuebe is there any way to customize the text color of "Cancel" button? It is taking native color right now.
Kind regards
@smstuebe any update on this?
You can do this =>
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
return inflater.Inflate(Resource.Layout.some_xml_file, container, false);
}
-> 1.4.6 You can set
DefaultColor
in a custom dialog now.
Hello! How can I change tooltip text color in the dialog?
-> 1.4.6 You can set
DefaultColor
in a custom dialog now.Hello! How can I change tooltip text color in the dialog?
@BogaDev get reference to the widget in the onCreateView override then customise it as you want
-> 1.4.6 You can set
DefaultColor
in a custom dialog now.Hello! How can I change tooltip text color in the dialog?
@BogaDev get reference to the widget in the onCreateView override then customise it as you want
Thank you for the answer! Could you please give an example? Because Im really stuck at this point
I could do with some examples on this. I can only seem to find the background property to update. Not text color.
I could do with some examples on this. I can only seem to find the background property to update. Not text color.
I found how to change background color, that was pretty simple, but text color changing looks really complicated. If you could help, I would be very grateful
@BogaDev @georgeharnwell @foehammer88 @ruisilva450 @marualderete
So I finally got the time to upload my implementation that allows me use my custom xml layout, reference widgets from the layout in my extended FingerprintDialogFragment => "ZetagikCustomFingerprintDialogFragment" and even change the dialog type to "BottomSheetDialog". Also, don't forget to modify your MainApplication.cs to use this customised FingerprintDialogFragment.
Hope this answers the questions related to customisations and @smstuebe accepts my PR since it modifies only the sample project and can serve as a guide for others too hopefully.
https://github.com/smstuebe/xamarin-fingerprint/commit/c7262476758fc1b459b2569c38b789c88e6a9e8c
That is NICE! Thank you!
@alvynfash you are just... wizard. Thank you so much
When I create a default setup using a light theme, the baked in fragment shows a white background with a white fingerprint icon. I'd like the ability to tint the icon to a different color if possible.
I know we can create a custom Fragment, but I'm not sure how that works within your plugin. I'd like to keep everything else exactly as it is (white background, black text), but simply color the icon something different so that it is visible.
Steps to reproduce
Follow initial setup and use the following theme in your android app ``Theme.AppCompat.Light.NoActionBar
Test
Expected behavior
Fingerprint image should be visible on the dialog fragment
Actual behavior
Fingerprint image is the same color as the background (white).
Configuration
Version of the Plugin: 1.4.2
Platform: Android 7.1
Device: Google Pixel XL