summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java5
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java6
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.java5
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java5
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ToCloneOrNot.kt4
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.kt6
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt96
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java10
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/config/SshApiSessionFactory.java1
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt4
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt92
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt4
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/FolderRecyclerAdapter.java2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/Otp.java9
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordItem.java1
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java1
19 files changed, 144 insertions, 113 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
index c92f037e..19cc2565 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
@@ -3,17 +3,19 @@ package com.zeapo.pwdstore;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
-import androidx.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.zeapo.pwdstore.utils.PasswordItem;
import com.zeapo.pwdstore.utils.PasswordRecyclerAdapter;
@@ -40,6 +42,7 @@ public class PasswordFragment extends Fragment {
private RecyclerView recyclerView;
private OnFragmentInteractionListener mListener;
private SharedPreferences settings;
+
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
index b75aafd3..703e10fc 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -12,7 +12,6 @@ import android.graphics.Color;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.os.Bundle;
-import androidx.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
@@ -20,15 +19,17 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
-import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
+import androidx.preference.PreferenceManager;
+
import com.google.android.material.snackbar.Snackbar;
import com.zeapo.pwdstore.crypto.PgpActivity;
import com.zeapo.pwdstore.git.GitActivity;
@@ -37,6 +38,7 @@ import com.zeapo.pwdstore.git.GitOperation;
import com.zeapo.pwdstore.utils.PasswordItem;
import com.zeapo.pwdstore.utils.PasswordRecyclerAdapter;
import com.zeapo.pwdstore.utils.PasswordRepository;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.eclipse.jgit.api.Git;
diff --git a/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.java b/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.java
index ba5296c8..144e8ab5 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.java
@@ -2,16 +2,18 @@ package com.zeapo.pwdstore;
import android.content.Context;
import android.os.Bundle;
-import androidx.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
+import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.zeapo.pwdstore.utils.FolderRecyclerAdapter;
import com.zeapo.pwdstore.utils.PasswordItem;
@@ -34,6 +36,7 @@ public class SelectFolderFragment extends Fragment {
private FolderRecyclerAdapter recyclerAdapter;
private RecyclerView recyclerView;
private OnFragmentInteractionListener mListener;
+
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
diff --git a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
index 6218bf0e..593a9bbb 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
+++ b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
@@ -12,7 +12,6 @@ import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
-import androidx.preference.PreferenceManager;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
@@ -25,10 +24,14 @@ import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
+
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.PreferenceManager;
+
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.KeyPair;
+
import org.apache.commons.io.FileUtils;
import java.io.File;
diff --git a/app/src/main/java/com/zeapo/pwdstore/ToCloneOrNot.kt b/app/src/main/java/com/zeapo/pwdstore/ToCloneOrNot.kt
index 75a7d4fc..4b1fdf55 100644
--- a/app/src/main/java/com/zeapo/pwdstore/ToCloneOrNot.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/ToCloneOrNot.kt
@@ -9,8 +9,8 @@ import androidx.fragment.app.Fragment
class ToCloneOrNot : Fragment() {
override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_to_clone_or_not, container, false)
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
index 7f35db6f..349b5b1b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt
@@ -31,7 +31,9 @@ import java.io.File
import java.io.IOException
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
-import java.util.*
+import java.util.Calendar
+import java.util.HashSet
+import java.util.TimeZone
class UserPreference : AppCompatActivity() {
@@ -310,7 +312,7 @@ class UserPreference : AppCompatActivity() {
val am = this
.getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
val runningServices = am
- .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC)
+ .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC)
return runningServices
.map { it.id.substringBefore("/") }
.any { it == BuildConfig.APPLICATION_ID }
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt
index 3e939b26..db6c3ed8 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillFragment.kt
@@ -71,7 +71,7 @@ class AutofillFragment : DialogFragment() {
}
(view.findViewById<View>(R.id.matched) as ListView).adapter = adapter
// delete items by clicking them
- (view.findViewById<View>(R.id.matched) as ListView).setOnItemClickListener { _, _, position, _ -> adapter!!.remove(adapter!!.getItem(position)) }
+ (view.findViewById<View>(R.id.matched) as ListView).onItemClickListener = { _, _, position, _ -> adapter!!.remove(adapter!!.getItem(position)) }
// set the existing preference, if any
val prefs: SharedPreferences = if (!isWeb) {
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
index 7416945e..ca6c14e8 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
@@ -37,7 +37,11 @@ import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.UserPreference
import com.zeapo.pwdstore.utils.Otp
import kotlinx.android.synthetic.main.decrypt_layout.*
-import kotlinx.android.synthetic.main.encrypt_layout.*
+import kotlinx.android.synthetic.main.encrypt_layout.crypto_extra_edit
+import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_category
+import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_edit
+import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_file_edit
+import kotlinx.android.synthetic.main.encrypt_layout.generate_password
import org.apache.commons.io.FileUtils
import org.apache.commons.io.FilenameUtils
import org.openintents.openpgp.IOpenPgpService2
@@ -75,16 +79,18 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
private val name: String by lazy { getName(fullPath) }
private val lastChangedString: CharSequence by lazy {
getLastChangedString(
- intent.getIntExtra(
- "LAST_CHANGED_TIMESTAMP",
- -1
- )
+ intent.getIntExtra(
+ "LAST_CHANGED_TIMESTAMP",
+ -1
+ )
)
}
private val relativeParentPath: String by lazy { getParentPath(fullPath, repoPath) }
val settings: SharedPreferences by lazy { PreferenceManager.getDefaultSharedPreferences(this) }
- private val keyIDs: MutableSet<String> by lazy { settings.getStringSet("openpgp_key_ids_set", mutableSetOf()) ?: emptySet() }
+ private val keyIDs: MutableSet<String> by lazy {
+ settings.getStringSet("openpgp_key_ids_set", mutableSetOf()) ?: emptySet()
+ }
private var mServiceConnection: OpenPgpServiceConnection? = null
override fun onCreate(savedInstanceState: Bundle?) {
@@ -192,8 +198,8 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
val pi: PendingIntent = result.getParcelableExtra(RESULT_INTENT)
try {
this@PgpActivity.startIntentSenderFromChild(
- this@PgpActivity, pi.intentSender, requestCode,
- null, 0, 0, 0
+ this@PgpActivity, pi.intentSender, requestCode,
+ null, 0, 0, 0
)
} catch (e: IntentSender.SendIntentException) {
Log.e(TAG, "SendIntentException", e)
@@ -265,8 +271,8 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
null
} else {
HoldToShowPasswordTransformation(
- crypto_password_toggle_show,
- Runnable { crypto_password_show.text = entry.password }
+ crypto_password_toggle_show,
+ Runnable { crypto_password_show.text = entry.password }
)
}
@@ -319,19 +325,19 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
if (entry.hasTotp()) {
crypto_copy_otp.setOnClickListener {
copyOtpToClipBoard(
- Otp.calculateCode(
- entry.totpSecret,
- Date().time / (1000 * entry.totpPeriod),
- entry.totpAlgorithm,
- entry.digits)
+ Otp.calculateCode(
+ entry.totpSecret,
+ Date().time / (1000 * entry.totpPeriod),
+ entry.totpAlgorithm,
+ entry.digits)
)
}
crypto_otp_show.text =
- Otp.calculateCode(
- entry.totpSecret,
- Date().time / (1000 * entry.totpPeriod),
- entry.totpAlgorithm,
- entry.digits)
+ Otp.calculateCode(
+ entry.totpSecret,
+ Date().time / (1000 * entry.totpPeriod),
+ entry.totpAlgorithm,
+ entry.digits)
} else {
// we only want to calculate and show HOTP if the user requests it
crypto_copy_otp.setOnClickListener {
@@ -346,31 +352,31 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
val checkInflater = LayoutInflater.from(this)
val checkLayout = checkInflater.inflate(R.layout.otp_confirm_layout, null)
val rememberCheck: CheckBox =
- checkLayout.findViewById(R.id.hotp_remember_checkbox)
+ checkLayout.findViewById(R.id.hotp_remember_checkbox)
val dialogBuilder = AlertDialog.Builder(this)
dialogBuilder.setView(checkLayout)
dialogBuilder.setMessage(R.string.dialog_update_body)
- .setCancelable(false)
- .setPositiveButton(R.string.dialog_update_positive) { _, _ ->
- run {
- calculateAndCommitHotp(entry)
- if (rememberCheck.isChecked) {
+ .setCancelable(false)
+ .setPositiveButton(R.string.dialog_update_positive) { _, _ ->
+ run {
+ calculateAndCommitHotp(entry)
+ if (rememberCheck.isChecked) {
+ val editor = settings.edit()
+ editor.putBoolean("hotp_remember_check", true)
+ editor.putBoolean("hotp_remember_choice", true)
+ editor.apply()
+ }
+ }
+ }
+ .setNegativeButton(R.string.dialog_update_negative) { _, _ ->
+ run {
+ calculateHotp(entry)
val editor = settings.edit()
editor.putBoolean("hotp_remember_check", true)
- editor.putBoolean("hotp_remember_choice", true)
+ editor.putBoolean("hotp_remember_choice", false)
editor.apply()
}
}
- }
- .setNegativeButton(R.string.dialog_update_negative) { _, _ ->
- run {
- calculateHotp(entry)
- val editor = settings.edit()
- editor.putBoolean("hotp_remember_check", true)
- editor.putBoolean("hotp_remember_choice", false)
- editor.apply()
- }
- }
val updateDialog = dialogBuilder.create()
updateDialog.setTitle(R.string.dialog_update_title)
updateDialog.show()
@@ -602,7 +608,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
}
private inner class HoldToShowPasswordTransformation constructor(button: Button, private val onToggle: Runnable) :
- PasswordTransformationMethod(), View.OnTouchListener {
+ PasswordTransformationMethod(), View.OnTouchListener {
private var shown = false
init {
@@ -673,10 +679,10 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
sendIntent.putExtra(Intent.EXTRA_TEXT, passwordEntry?.password)
sendIntent.type = "text/plain"
startActivity(
- Intent.createChooser(
- sendIntent,
- resources.getText(R.string.send_plaintext_password_to)
- )
+ Intent.createChooser(
+ sendIntent,
+ resources.getText(R.string.send_plaintext_password_to)
+ )
)//Always show a picker to give the user a chance to cancel
}
@@ -777,8 +783,8 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
for (i in 0..19) {
val count = i.toString()
handler.postDelayed(
- { clipboard.setPrimaryClip(ClipData.newPlainText(count, count)) },
- (i * 500).toLong()
+ { clipboard.setPrimaryClip(ClipData.newPlainText(count, count)) },
+ (i * 500).toLong()
)
}
}
@@ -815,7 +821,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
* Gets the relative path to the repository
*/
fun getRelativePath(fullPath: String, repositoryPath: String): String =
- fullPath.replace(repositoryPath, "").replace("/+".toRegex(), "/")
+ fullPath.replace(repositoryPath, "").replace("/+".toRegex(), "/")
/**
* Gets the Parent path, relative to the repository
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
index 7c6df673..1b354c5b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
@@ -4,8 +4,10 @@ import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.util.Log;
+
import com.zeapo.pwdstore.PasswordStore;
import com.zeapo.pwdstore.R;
+
import org.eclipse.jgit.api.CommitCommand;
import org.eclipse.jgit.api.GitCommand;
import org.eclipse.jgit.api.PullCommand;
@@ -26,10 +28,6 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> {
private ProgressDialog dialog;
private GitOperation operation;
- private Activity getActivity() {
- return activityWeakReference.get();
- }
-
public GitAsyncTask(Activity activity, boolean finishOnEnd, boolean refreshListOnEnd, GitOperation operation) {
this.activityWeakReference = new WeakReference<>(activity);
this.finishOnEnd = finishOnEnd;
@@ -39,6 +37,10 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> {
dialog = new ProgressDialog(getActivity());
}
+ private Activity getActivity() {
+ return activityWeakReference.get();
+ }
+
protected void onPreExecute() {
this.dialog.setMessage(getActivity().getResources().getString(R.string.running_dialog_text));
this.dialog.setCancelable(false);
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/config/SshApiSessionFactory.java b/app/src/main/java/com/zeapo/pwdstore/git/config/SshApiSessionFactory.java
index f3d2f20a..085beadd 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/config/SshApiSessionFactory.java
+++ b/app/src/main/java/com/zeapo/pwdstore/git/config/SshApiSessionFactory.java
@@ -43,6 +43,7 @@ public class SshApiSessionFactory extends GitConfigSessionFactory {
public static final int POST_SIGNATURE = 301;
private String username;
private Identity identity;
+
public SshApiSessionFactory(String username, Identity identity) {
this.username = username;
this.identity = identity;
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt
index dcb2c199..29d2dd73 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt
@@ -6,7 +6,6 @@ import com.zeapo.pwdstore.R
import java.util.ArrayList
-
object PasswordGenerator {
internal const val DIGITS = 0x0001
internal const val UPPERS = 0x0002
@@ -82,7 +81,8 @@ object PasswordGenerator {
* preferences file 'PasswordGenerator'
* @return list of generated passwords
*/
- @JvmStatic @Throws(PasswordGenerator.PasswordGeneratorExeption::class)
+ @JvmStatic
+ @Throws(PasswordGenerator.PasswordGeneratorExeption::class)
fun generate(ctx: Context): ArrayList<String> {
val prefs = ctx.getSharedPreferences("PasswordGenerator", Context.MODE_PRIVATE)
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt
index 24d1edef..73141c1a 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/Phonemes.kt
@@ -7,46 +7,46 @@ internal object Phonemes {
private const val NOT_FIRST = 0x0008
private val elements = arrayOf(
- Element("a", VOWEL),
- Element("ae", VOWEL or DIPTHONG),
- Element("ah", VOWEL or DIPTHONG),
- Element("ai", VOWEL or DIPTHONG),
- Element("b", CONSONANT),
- Element("c", CONSONANT),
- Element("ch", CONSONANT or DIPTHONG),
- Element("d", CONSONANT),
- Element("e", VOWEL),
- Element("ee", VOWEL or DIPTHONG),
- Element("ei", VOWEL or DIPTHONG),
- Element("f", CONSONANT),
- Element("g", CONSONANT),
- Element("gh", CONSONANT or DIPTHONG or NOT_FIRST),
- Element("h", CONSONANT),
- Element("i", VOWEL),
- Element("ie", VOWEL or DIPTHONG),
- Element("j", CONSONANT),
- Element("k", CONSONANT),
- Element("l", CONSONANT),
- Element("m", CONSONANT),
- Element("n", CONSONANT),
- Element("ng", CONSONANT or DIPTHONG or NOT_FIRST),
- Element("o", VOWEL),
- Element("oh", VOWEL or DIPTHONG),
- Element("oo", VOWEL or DIPTHONG),
- Element("p", CONSONANT),
- Element("ph", CONSONANT or DIPTHONG),
- Element("qu", CONSONANT or DIPTHONG),
- Element("r", CONSONANT),
- Element("s", CONSONANT),
- Element("sh", CONSONANT or DIPTHONG),
- Element("t", CONSONANT),
- Element("th", CONSONANT or DIPTHONG),
- Element("u", VOWEL),
- Element("v", CONSONANT),
- Element("w", CONSONANT),
- Element("x", CONSONANT),
- Element("y", CONSONANT),
- Element("z", CONSONANT)
+ Element("a", VOWEL),
+ Element("ae", VOWEL or DIPTHONG),
+ Element("ah", VOWEL or DIPTHONG),
+ Element("ai", VOWEL or DIPTHONG),
+ Element("b", CONSONANT),
+ Element("c", CONSONANT),
+ Element("ch", CONSONANT or DIPTHONG),
+ Element("d", CONSONANT),
+ Element("e", VOWEL),
+ Element("ee", VOWEL or DIPTHONG),
+ Element("ei", VOWEL or DIPTHONG),
+ Element("f", CONSONANT),
+ Element("g", CONSONANT),
+ Element("gh", CONSONANT or DIPTHONG or NOT_FIRST),
+ Element("h", CONSONANT),
+ Element("i", VOWEL),
+ Element("ie", VOWEL or DIPTHONG),
+ Element("j", CONSONANT),
+ Element("k", CONSONANT),
+ Element("l", CONSONANT),
+ Element("m", CONSONANT),
+ Element("n", CONSONANT),
+ Element("ng", CONSONANT or DIPTHONG or NOT_FIRST),
+ Element("o", VOWEL),
+ Element("oh", VOWEL or DIPTHONG),
+ Element("oo", VOWEL or DIPTHONG),
+ Element("p", CONSONANT),
+ Element("ph", CONSONANT or DIPTHONG),
+ Element("qu", CONSONANT or DIPTHONG),
+ Element("r", CONSONANT),
+ Element("s", CONSONANT),
+ Element("sh", CONSONANT or DIPTHONG),
+ Element("t", CONSONANT),
+ Element("th", CONSONANT or DIPTHONG),
+ Element("u", VOWEL),
+ Element("v", CONSONANT),
+ Element("w", CONSONANT),
+ Element("x", CONSONANT),
+ Element("y", CONSONANT),
+ Element("z", CONSONANT)
)
private val NUM_ELEMENTS = elements.size
@@ -106,7 +106,7 @@ internal object Phonemes {
}
// Don't allow VOWEL followed a Vowel/Dipthong pair
if (prev and VOWEL > 0 && flags and VOWEL > 0
- && flags and DIPTHONG > 0
+ && flags and DIPTHONG > 0
) {
continue
}
@@ -165,8 +165,8 @@ internal object Phonemes {
cha = Character.forDigit(RandomNumberGenerator.number(10), 10)
`val` = cha.toString()
} while (pwFlags and PasswordGenerator.AMBIGUOUS > 0 && PasswordGenerator.AMBIGUOUS_STR.contains(
- `val`
- )
+ `val`
+ )
)
password += `val`
curSize++
@@ -190,8 +190,8 @@ internal object Phonemes {
cha = PasswordGenerator.SYMBOLS_STR.toCharArray()[num]
`val` = cha.toString()
} while (pwFlags and PasswordGenerator.AMBIGUOUS > 0 && PasswordGenerator.AMBIGUOUS_STR.contains(
- `val`
- )
+ `val`
+ )
)
password += `val`
curSize++
@@ -205,7 +205,7 @@ internal object Phonemes {
VOWEL
} else {
if (prev and VOWEL > 0 || flags and DIPTHONG > 0
- || RandomNumberGenerator.number(10) > 3
+ || RandomNumberGenerator.number(10) > 3
) {
CONSONANT
} else {
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
index 5e565c0e..66147709 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/RandomPasswordGenerator.kt
@@ -49,8 +49,8 @@ internal object RandomPasswordGenerator {
cha = bank.toCharArray()[num]
`val` = cha.toString()
if (pwFlags and PasswordGenerator.AMBIGUOUS > 0 && PasswordGenerator.AMBIGUOUS_STR.contains(
- `val`
- )
+ `val`
+ )
) {
continue
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java
index c108cb52..eba6a02e 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java
@@ -8,9 +8,11 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
+
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
+
import com.zeapo.pwdstore.R;
import java.util.ArrayList;
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/FolderRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/FolderRecyclerAdapter.java
index f6a29113..1754e0f9 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/FolderRecyclerAdapter.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/FolderRecyclerAdapter.java
@@ -1,7 +1,9 @@
package com.zeapo.pwdstore.utils;
import android.view.View;
+
import androidx.annotation.NonNull;
+
import com.zeapo.pwdstore.SelectFolderActivity;
import com.zeapo.pwdstore.SelectFolderFragment;
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java b/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java
index 2e6bebd6..cb949f2e 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/Otp.java
@@ -1,16 +1,18 @@
package com.zeapo.pwdstore.utils;
import android.util.Log;
+
import org.apache.commons.codec.binary.Base32;
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
public class Otp {
private static final Base32 BASE_32 = new Base32();
@@ -50,7 +52,6 @@ public class Otp {
bigInt /= 26;
}
return output.toString();
- }
- else return strCode.substring(strCode.length() - Integer.parseInt(digits));
+ } else return strCode.substring(strCode.length() - Integer.parseInt(digits));
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordItem.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordItem.java
index b79f2130..1a498721 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordItem.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordItem.java
@@ -1,6 +1,7 @@
package com.zeapo.pwdstore.utils;
import androidx.annotation.NonNull;
+
import com.zeapo.pwdstore.crypto.PgpActivity;
import java.io.File;
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
index 83244a3f..9170e408 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
@@ -3,8 +3,10 @@ package com.zeapo.pwdstore.utils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+
import androidx.annotation.NonNull;
import androidx.appcompat.view.ActionMode;
+
import com.zeapo.pwdstore.PasswordFragment;
import com.zeapo.pwdstore.PasswordStore;
import com.zeapo.pwdstore.R;
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java
index e79acac8..9c27a448 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
+
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;