Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default setup uses white fragment with white fingerprint icon #51

Closed
ChaseFlorell opened this issue Mar 23, 2017 · 23 comments
Closed

Default setup uses white fragment with white fingerprint icon #51

ChaseFlorell opened this issue Mar 23, 2017 · 23 comments
Assignees
Milestone

Comments

@ChaseFlorell
Copy link

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

  1. Follow initial setup and use the following theme in your android app ``Theme.AppCompat.Light.NoActionBar

  2. 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

@smsissuechecker
Copy link

Hi @ChaseFlorell,

I'm the friendly issue checker.
Thanks for using the issue template 🌟
I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.

@ChaseFlorell
Copy link
Author

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;
    }
}

@smstuebe
Copy link
Owner

smstuebe commented Mar 23, 2017

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.

@ChaseFlorell
Copy link
Author

That would be pretty cool @smstuebe. For now my workaround will do just fine.

@smstuebe
Copy link
Owner

smstuebe commented Mar 23, 2017

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 ^^

@smstuebe smstuebe reopened this Mar 23, 2017
@smstuebe smstuebe self-assigned this Mar 23, 2017
@smstuebe smstuebe changed the title [Android] Default setup uses white fragment with white fingerprint icon Default setup uses white fragment with white fingerprint icon Mar 23, 2017
@ChaseFlorell
Copy link
Author

ChaseFlorell commented Mar 23, 2017

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.

@ChaseFlorell
Copy link
Author

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);
        }

@smstuebe
Copy link
Owner

smstuebe commented Mar 23, 2017

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.

@NightOwlCoder
Copy link

Hey guys, was this fixed?
I'm having a hard time on my app with the white on white...

@smstuebe
Copy link
Owner

oupsi, no. I'll move it to Milestone 1.4.6.

@smstuebe smstuebe added this to the 1.4.6 milestone Aug 30, 2017
@ruisilva450
Copy link

ruisilva450 commented Nov 9, 2017

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.

@foehammer88
Copy link

@smstuebe any update on this?

@smstuebe
Copy link
Owner

-> 1.4.6
You can set DefaultColor in a custom dialog now.

@marualderete
Copy link

@smstuebe is there any way to customize the text color of "Cancel" button? It is taking native color right now.

Kind regards

@alvynfash
Copy link

alvynfash commented Jan 14, 2019

@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);
}

@Bogenbai
Copy link

-> 1.4.6
You can set DefaultColor in a custom dialog now.

Hello! How can I change tooltip text color in the dialog?

@alvynfash
Copy link

-> 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

@Bogenbai
Copy link

-> 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

@georgeharnwell
Copy link

I could do with some examples on this. I can only seem to find the background property to update. Not text color.

@Bogenbai
Copy link

Bogenbai commented Mar 5, 2019

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

@alvynfash
Copy link

alvynfash commented Mar 6, 2019

@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.

c726247

@georgeharnwell
Copy link

That is NICE! Thank you!

@Bogenbai
Copy link

Bogenbai commented Apr 2, 2019

@alvynfash you are just... wizard.
Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants