use of android.support.annotation.RequiresApi in project run-wallet-android by runplay.
the class NotificationHelper method createNotificationChannel.
@RequiresApi(api = Build.VERSION_CODES.O)
private static void createNotificationChannel(Context context) {
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL, context.getResources().getString(R.string.app_name), NotificationManager.IMPORTANCE_MIN);
notificationManager.createNotificationChannel(channel);
}
use of android.support.annotation.RequiresApi in project AlarmAndJob by dxsdyhm.
the class TostServiceHelper method initScedule.
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void initScedule(Context context) {
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
JobInfo jobInfo = new JobInfo.Builder(1, new ComponentName(context.getPackageName(), ToastJobService.class.getName())).setPeriodic(SCEDULE_TIME).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY).setRequiresCharging(true).build();
jobScheduler.schedule(jobInfo);
}
use of android.support.annotation.RequiresApi in project KeePassDX by Kunzisoft.
the class GroupActivity method launch.
@RequiresApi(api = Build.VERSION_CODES.O)
public static void launch(Activity act, PwGroup group, AssistStructure assistStructure) {
if (assistStructure != null) {
if (LockingActivity.checkTimeIsAllowedOrFinish(act)) {
Intent intent = new Intent(act, GroupActivity.class);
if (group != null) {
intent.putExtra(GROUP_ID_KEY, group.getId());
}
AutofillHelper.addAssistStructureExtraInIntent(intent, assistStructure);
act.startActivityForResult(intent, AutofillHelper.AUTOFILL_RESPONSE_REQUEST_CODE);
}
} else {
launch(act, group);
}
}
use of android.support.annotation.RequiresApi in project KeePassDX by Kunzisoft.
the class PasswordActivity method initForFingerprint.
// fingerprint related code here
@RequiresApi(api = Build.VERSION_CODES.M)
private void initForFingerprint() {
fingerPrintMode = NOT_CONFIGURED_MODE;
fingerPrintHelper = new FingerPrintHelper(this, this);
// when text entered we can enable the logon/purchase button and if required update encryption/decryption mode
passwordView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) {
}
@Override
public void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
}
@Override
public void afterTextChanged(final Editable s) {
if (!fingerprintMustBeConfigured) {
final boolean validInput = s.length() > 0;
// encrypt or decrypt mode based on how much input or not
setFingerPrintView(validInput ? R.string.store_with_fingerprint : R.string.scanning_fingerprint);
if (validInput)
toggleFingerprintMode(STORE_MODE);
else
toggleFingerprintMode(OPEN_MODE);
}
}
});
// callback for fingerprint findings
fingerPrintHelper.setAuthenticationCallback(new FingerprintManagerCompat.AuthenticationCallback() {
@Override
public void onAuthenticationError(final int errorCode, final CharSequence errString) {
switch(errorCode) {
case 5:
Log.i(TAG, "Fingerprint authentication error. Code : " + errorCode + " Error : " + errString);
break;
default:
Log.e(TAG, "Fingerprint authentication error. Code : " + errorCode + " Error : " + errString);
setFingerPrintView(errString.toString(), true);
}
}
@Override
public void onAuthenticationHelp(final int helpCode, final CharSequence helpString) {
Log.w(TAG, "Fingerprint authentication help. Code : " + helpCode + " Help : " + helpString);
showError(helpString);
setFingerPrintView(helpString.toString(), true);
fingerprintTextView.setText(helpString);
}
@Override
public void onAuthenticationFailed() {
Log.e(TAG, "Fingerprint authentication failed, fingerprint not recognized");
showError(R.string.fingerprint_not_recognized);
}
@Override
public void onAuthenticationSucceeded(final FingerprintManagerCompat.AuthenticationResult result) {
switch(fingerPrintMode) {
case STORE_MODE:
// newly store the entered password in encrypted way
final String password = passwordView.getText().toString();
fingerPrintHelper.encryptData(password);
break;
case OPEN_MODE:
// retrieve the encrypted value from preferences
final String encryptedValue = prefsNoBackup.getString(getPreferenceKeyValue(), null);
if (encryptedValue != null) {
fingerPrintHelper.decryptData(encryptedValue);
}
break;
}
}
});
}
use of android.support.annotation.RequiresApi in project KeePassDX by Kunzisoft.
the class PasswordActivity method launch.
@RequiresApi(api = Build.VERSION_CODES.O)
public static void launch(Activity act, String fileName, String keyFile, AssistStructure assistStructure) throws FileNotFoundException {
verifyFileNameUriFromLaunch(fileName);
if (assistStructure != null) {
Intent intent = new Intent(act, PasswordActivity.class);
intent.putExtra(UriIntentInitTask.KEY_FILENAME, fileName);
intent.putExtra(UriIntentInitTask.KEY_KEYFILE, keyFile);
AutofillHelper.addAssistStructureExtraInIntent(intent, assistStructure);
act.startActivityForResult(intent, AutofillHelper.AUTOFILL_RESPONSE_REQUEST_CODE);
} else {
launch(act, fileName, keyFile);
}
}
Aggregations