Guest User

FingerprintModule

a guest
Jun 7th, 2016
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2015 The Android Open Source Project
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License
  15.  */
  16.  
  17. package com.example.uz_system_1.lockscreen;
  18.  
  19. import android.content.Context;
  20. import android.content.SharedPreferences;
  21. import android.preference.PreferenceManager;
  22. import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
  23. import android.view.inputmethod.InputMethodManager;
  24.  
  25. import com.example.uz_system_1.lockscreen.MainActivity;
  26.  
  27. import dagger.Module;
  28. import dagger.Provides;
  29.  
  30. /**
  31.  * Dagger module for Fingerprint APIs.
  32.  */
  33. @Module(
  34.         library = true,
  35.         injects = {MainActivity.class}
  36. )
  37. public class FingerprintModule {
  38.  
  39.     private final Context mContext;
  40.  
  41.     public FingerprintModule(Context context) {
  42.         mContext = context;
  43.     }
  44.  
  45.     @Provides
  46.     public Context providesContext() {
  47.         return mContext;
  48.     }
  49.  
  50.     @Provides
  51.     public FingerprintManagerCompat providesFingerprintManager(Context context) {
  52.         return FingerprintManagerCompat.from(context);
  53.     }
  54.  
  55.     @Provides
  56.     public InputMethodManager providesInputMethodManager(Context context) {
  57.         return (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
  58.     }
  59.  
  60.     @Provides
  61.     public SharedPreferences providesSharedPreferences(Context context) {
  62.         return PreferenceManager.getDefaultSharedPreferences(context);
  63.     }
  64. }
Add Comment
Please, Sign In to add comment