org.telegram.messenger.support.fingerprint.FingerprintManagerCompat Java Examples

The following examples show how to use org.telegram.messenger.support.fingerprint.FingerprintManagerCompat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PasscodeActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void updateRows()
{
    rowCount = 0;
    passcodeRow = rowCount++;
    changePasscodeRow = rowCount++;
    passcodeDetailRow = rowCount++;
    if (SharedConfig.passcodeHash.length() > 0)
    {
        try
        {
            if (Build.VERSION.SDK_INT >= 23)
            {
                FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(ApplicationLoader.applicationContext);
                if (fingerprintManager.isHardwareDetected())
                {
                    fingerprintRow = rowCount++;
                }
            }
        }
        catch (Throwable e)
        {
            FileLog.e(e);
        }
        autoLockRow = rowCount++;
        autoLockDetailRow = rowCount++;
        captureRow = rowCount++;
        captureDetailRow = rowCount++;
    }
    else
    {
        captureRow = -1;
        captureDetailRow = -1;
        fingerprintRow = -1;
        autoLockRow = -1;
        autoLockDetailRow = -1;
    }
}
 
Example #2
Source File: PasscodeActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void updateRows()
{
    rowCount = 0;
    passcodeRow = rowCount++;
    changePasscodeRow = rowCount++;
    passcodeDetailRow = rowCount++;
    if (SharedConfig.passcodeHash.length() > 0)
    {
        try
        {
            if (Build.VERSION.SDK_INT >= 23)
            {
                FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(ApplicationLoader.applicationContext);
                if (fingerprintManager.isHardwareDetected())
                {
                    fingerprintRow = rowCount++;
                }
            }
        }
        catch (Throwable e)
        {
            FileLog.e(e);
        }
        autoLockRow = rowCount++;
        autoLockDetailRow = rowCount++;
        captureRow = rowCount++;
        captureDetailRow = rowCount++;
    }
    else
    {
        captureRow = -1;
        captureDetailRow = -1;
        fingerprintRow = -1;
        autoLockRow = -1;
        autoLockDetailRow = -1;
    }
}
 
Example #3
Source File: PasscodeActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void updateRows() {
    rowCount = 0;
    passcodeRow = rowCount++;
    changePasscodeRow = rowCount++;
    passcodeDetailRow = rowCount++;
    if (SharedConfig.passcodeHash.length() > 0) {
        try {
            if (Build.VERSION.SDK_INT >= 23) {
                FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(ApplicationLoader.applicationContext);
                if (fingerprintManager.isHardwareDetected()) {
                    fingerprintRow = rowCount++;
                }
            }
        } catch (Throwable e) {
            FileLog.e(e);
        }
        autoLockRow = rowCount++;
        autoLockDetailRow = rowCount++;
        captureRow = rowCount++;
        captureDetailRow = rowCount++;
    } else {
        captureRow = -1;
        captureDetailRow = -1;
        fingerprintRow = -1;
        autoLockRow = -1;
        autoLockDetailRow = -1;
    }
}
 
Example #4
Source File: TestActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void prepareSensor() {
    isKeyCreated();
    initCipher(Cipher.DECRYPT_MODE);
    FingerprintManagerCompat.CryptoObject cryptoObject = new FingerprintManagerCompat.CryptoObject(cipher);

    if (cryptoObject != null) {
        Toast.makeText(getParentActivity(), "use fingerprint to login", Toast.LENGTH_LONG).show();
        fingerprintHelper = new FingerprintHelper(getParentActivity());
        fingerprintHelper.startAuth(cryptoObject);
    } else {
        Toast.makeText(getParentActivity(), "new fingerprint enrolled. enter pin again", Toast.LENGTH_SHORT).show();
    }
}
 
Example #5
Source File: TestActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
    Cipher cipher = result.getCryptoObject().getCipher();
    String decoded = decode(encryptedString, cipher);
    codeField.setText(decoded);
    Toast.makeText(mContext, "success", Toast.LENGTH_SHORT).show();
}
 
Example #6
Source File: PasscodeActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void updateRows() {
    rowCount = 0;
    passcodeRow = rowCount++;
    changePasscodeRow = rowCount++;
    passcodeDetailRow = rowCount++;
    if (SharedConfig.passcodeHash.length() > 0) {
        try {
            if (Build.VERSION.SDK_INT >= 23) {
                FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(ApplicationLoader.applicationContext);
                if (fingerprintManager.isHardwareDetected()) {
                    fingerprintRow = rowCount++;
                }
            }
        } catch (Throwable e) {
            FileLog.e(e);
        }
        autoLockRow = rowCount++;
        autoLockDetailRow = rowCount++;
        captureRow = rowCount++;
        captureDetailRow = rowCount++;
    } else {
        captureRow = -1;
        captureDetailRow = -1;
        fingerprintRow = -1;
        autoLockRow = -1;
        autoLockDetailRow = -1;
    }
}
 
Example #7
Source File: TestActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void prepareSensor() {
    isKeyCreated();
    initCipher(Cipher.DECRYPT_MODE);
    FingerprintManagerCompat.CryptoObject cryptoObject = new FingerprintManagerCompat.CryptoObject(cipher);

    if (cryptoObject != null) {
        Toast.makeText(getParentActivity(), "use fingerprint to login", Toast.LENGTH_LONG).show();
        fingerprintHelper = new FingerprintHelper(getParentActivity());
        fingerprintHelper.startAuth(cryptoObject);
    } else {
        Toast.makeText(getParentActivity(), "new fingerprint enrolled. enter pin again", Toast.LENGTH_SHORT).show();
    }
}
 
Example #8
Source File: TestActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
    Cipher cipher = result.getCryptoObject().getCipher();
    String decoded = decode(encryptedString, cipher);
    codeField.setText(decoded);
    Toast.makeText(mContext, "success", Toast.LENGTH_SHORT).show();
}
 
Example #9
Source File: TestActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
void startAuth(FingerprintManagerCompat.CryptoObject cryptoObject) {
    mCancellationSignal = new CancellationSignal();
    FingerprintManagerCompat manager = FingerprintManagerCompat.from(mContext);
    manager.authenticate(cryptoObject, 0, mCancellationSignal, this, null);
}
 
Example #10
Source File: TestActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
void startAuth(FingerprintManagerCompat.CryptoObject cryptoObject) {
    mCancellationSignal = new CancellationSignal();
    FingerprintManagerCompat manager = FingerprintManagerCompat.from(mContext);
    manager.authenticate(cryptoObject, 0, mCancellationSignal, this, null);
}