public static void Construct(FragmentActivity activity, Toolbar toolbar) { MovieDbFactory.RegisterSettings(new MovieDbSettings()); _topRatedHelper = new MovieHelper(); _searchHelper = new MovieHelper(); _movieApi = MovieDbFactory.Create <IApiMovieRequest>().Value; _topRatedFragment = new TopRatedMoviesFragment(_topRatedHelper, _movieApi); var fragments = new Fragment[] { new MovieSearchFragment(_searchHelper, _movieApi), _topRatedFragment }; var titles = CharSequence.ArrayFromStringArray(new[] { activity.GetString(Resource.String.SearchTab), activity.GetString(Resource.String.TopRatedTab) }); var viewPager = activity.FindViewById <ViewPager>(Resource.Id.viewpager); viewPager.Adapter = new TabsFragmentPagerAdapter(activity.SupportFragmentManager, fragments, titles); // Give the TabLayout the ViewPager var tabLayout = activity.FindViewById <TabLayout>(Resource.Id.sliding_tabs); tabLayout.SetupWithViewPager(viewPager); tabLayout.TabSelected += async(sender, args) => { var tab = args.Tab; if (tab.Position == 1) { viewPager.SetCurrentItem(tab.Position, true); var manager = (InputMethodManager)activity.GetSystemService(Context.InputMethodService); manager.HideSoftInputFromWindow(activity.CurrentFocus.WindowToken, 0); await _topRatedFragment.GetMovies(); } else { viewPager.SetCurrentItem(tab.Position, true); } }; SetToolbar(activity, toolbar); }
public void StartListening(BiometricPrompt.AuthenticationCallback callback) { Kp2aLog.Log("Fingerprint: StartListening "); var executor = Executors.NewSingleThreadExecutor(); _biometricPrompt = new BiometricPrompt(_activity, executor, callback); BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .SetTitle(_activity.GetString(AppNames.AppNameResource)) .SetSubtitle(_activity.GetString(Resource.String.unlock_database_title)) .SetNegativeButtonText(_activity.GetString(Android.Resource.String.Cancel)) .SetConfirmationRequired(false) .Build(); _biometricPrompt.Authenticate(promptInfo, _cryptoObject); }