Method start
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
public void start() {
Thread thread = new Thread(() -> {
status = context.getString(R.string.decrypting_data);
File tempDecryptedFile = new File(context.getCacheDir(), randomUUID().toString());
Method updateEncryptedData
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
public void updateEncryptedData() {
NotesDB db = getNotesDB();
NoteTable noteTable = getNoteTable();
FileInfoTable fileInfoTable = getFileInfoTable();
Method isAnyActivityVisible
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
public boolean isAnyActivityVisible() {
ActivityManager activityManager = (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
if (activityManager != null) {
Method run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
@Override
public void run() {
try {
while (thread.isAlive()) {
if (!FileViewerActivityBase.isRunning()) {
Method onCreateOptionsMenu
has 31 lines of code (exceeds 25 allowed). Consider refactoring.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
EditText nameField = findViewById(R.id.noteNameField);
EditText textField = findViewById(R.id.noteTextField);
Method authorize
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
public void authorize() {
String password = passwordBuilder.toString();
CryptoManager cryptoManager = App.getAppContainer().getCryptoManager();
TextView censoredPasswordView = activity.findViewById(R.id.censoredPasswordTextView);
Method decryptInfo
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
public static FileInfo decryptInfo(EncryptedFileInfo encryptedFileInfo, CryptoKey cryptoKey) {
Aes aes = new Aes(cryptoKey.getKey(), cryptoKey.getSalt());
try {
byte[] encryptedName = encryptedFileInfo.getEncryptedName();
Method authorize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
public void authorize() {
String password = passwordBuilder.toString();
CryptoManager cryptoManager = App.getAppContainer().getCryptoManager();
TextView censoredPasswordView = activity.findViewById(R.id.censoredPasswordTextView);
Method importKeyButtonOnClick
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
private View.OnClickListener importKeyButtonOnClick() {
return view -> {
String hexKey = keyField.getText().toString();
if (!hexKey.isBlank()) {
Method wipeFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
private Runnable wipeFile(TempFile tempFile) {
return () -> {
File file = new File(Objects.requireNonNull(tempFile.getUri().getPath()));
if (file.exists()) {
Method onCreate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Method proceedPasswordSetting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
private String proceedPasswordSetting() {
String password = passwordBuilder.toString();
TextView topLabel = activity.findViewById(R.id.authTopLabel);
if (createdPassword == null) {
Method cryptoKeyToHex
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
public static String cryptoKeyToHex(CryptoKey cryptoKey) {
byte[] keyBytes = cryptoKey.getKey().getEncoded();
byte[] salt = cryptoKey.getSalt();
byte[] bytes = new byte[keyBytes.length + salt.length];
Method onCreateOptionsMenu
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
EditText nameField = findViewById(R.id.noteNameField);
EditText textField = findViewById(R.id.noteTextField);
Method onOptionsItemSelected
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
Method selectFileCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
private ActivityResultCallback<ActivityResult> selectFileCallback() {
return result -> {
int resultCode = result.getResultCode();
if (resultCode == Activity.RESULT_OK) {
Method dataReceiver
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
private BroadcastReceiver dataReceiver() {
return new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String status = intent.getStringExtra("status");
Method wipeFileData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
private static void wipeFileData(File file) throws IOException {
long fileSize = file.length();
try (FileOutputStream stream = new FileOutputStream(file)) {
try {
Method start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
@Override
public void start() {
Thread thread = new Thread(() -> {
try {
tempDir = new File(context.getCacheDir(), randomUUID().toString());