treewide: Reformat with latest ktlint

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-11-06 19:42:39 +05:30
parent b2d352e3ea
commit be0d89958a
No known key found for this signature in database
GPG key ID: C2E74282C2133D62
45 changed files with 92 additions and 84 deletions

View file

@ -1,3 +1,7 @@
/*
* Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
package com.zeapo.pwdstore
import android.annotation.SuppressLint
@ -11,6 +15,10 @@ import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import com.zeapo.pwdstore.crypto.PgpActivity
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.nio.charset.StandardCharsets
import kotlinx.android.synthetic.main.decrypt_layout.crypto_extra_show
import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_category_decrypt
import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_file
@ -23,11 +31,6 @@ import org.junit.Assert.assertNotNull
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.nio.charset.StandardCharsets
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -121,7 +124,7 @@ class DecryptTest {
SystemClock.sleep(4000)
// The clipboard should be cleared!!
for(i in 0..clipboard.primaryClip.itemCount) {
for (i in 0..clipboard.primaryClip.itemCount) {
assertEquals("", clipboard.primaryClip.getItemAt(i).text)
}
@ -161,8 +164,4 @@ class DecryptTest {
}
}
}
}

View file

@ -1,3 +1,7 @@
/*
* Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
package com.zeapo.pwdstore
import android.annotation.SuppressLint
@ -15,13 +19,12 @@ import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import com.zeapo.pwdstore.crypto.PgpActivity
import java.io.File
import org.apache.commons.io.FileUtils
import org.apache.commons.io.IOUtils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import java.io.File
@RunWith(AndroidJUnit4::class)
@LargeTest
@ -80,6 +83,3 @@ class EncryptTest {
assert(File("$path/$name.gpg").exists())
}
}

View file

@ -1,7 +1,10 @@
/*
* Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
package com.zeapo.pwdstore;
import com.zeapo.pwdstore.utils.Otp;
import junit.framework.TestCase;
public class OtpTest extends TestCase {

View file

@ -1,3 +1,7 @@
/*
* Copyright © 2014-2019 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
package com.zeapo.pwdstore;
import junit.framework.TestCase;
@ -27,9 +31,14 @@ public class PasswordEntryTest extends TestCase {
}
public void testGetUsername() {
assertEquals("username", new PasswordEntry("secret\nextra\nlogin: username\ncontent\n").getUsername());
assertEquals("username", new PasswordEntry("\nextra\nusername: username\ncontent\n").getUsername());
assertEquals("username", new PasswordEntry("\nUSERNaMe: username\ncontent\n").getUsername());
assertEquals(
"username",
new PasswordEntry("secret\nextra\nlogin: username\ncontent\n").getUsername());
assertEquals(
"username",
new PasswordEntry("\nextra\nusername: username\ncontent\n").getUsername());
assertEquals(
"username", new PasswordEntry("\nUSERNaMe: username\ncontent\n").getUsername());
assertEquals("username", new PasswordEntry("\nLOGiN:username").getUsername());
assertNull(new PasswordEntry("secret\nextra\ncontent\n").getUsername());
}
@ -55,7 +64,9 @@ public class PasswordEntryTest extends TestCase {
}
public void testTotpUriInContent() {
PasswordEntry entry = new PasswordEntry("secret\nusername: test\notpauth://totp/test?secret=JBSWY3DPEHPK3PXP");
PasswordEntry entry =
new PasswordEntry(
"secret\nusername: test\notpauth://totp/test?secret=JBSWY3DPEHPK3PXP");
assertTrue(entry.hasTotp());
assertEquals("JBSWY3DPEHPK3PXP", entry.getTotpSecret());
}
@ -68,16 +79,19 @@ public class PasswordEntryTest extends TestCase {
}
public void testHotpUriInPassword() {
PasswordEntry entry = new PasswordEntry("otpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25");
assertTrue(entry.hasHotp());
assertEquals("JBSWY3DPEHPK3PXP", entry.getHotpSecret());
assertEquals(new Long(25 ), entry.getHotpCounter());
}
public void testHotpUriInContent() {
PasswordEntry entry = new PasswordEntry("secret\nusername: test\notpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25");
PasswordEntry entry =
new PasswordEntry("otpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25");
assertTrue(entry.hasHotp());
assertEquals("JBSWY3DPEHPK3PXP", entry.getHotpSecret());
assertEquals(new Long(25), entry.getHotpCounter());
}
}
public void testHotpUriInContent() {
PasswordEntry entry =
new PasswordEntry(
"secret\nusername: test\notpauth://hotp/test?secret=JBSWY3DPEHPK3PXP&counter=25");
assertTrue(entry.hasHotp());
assertEquals("JBSWY3DPEHPK3PXP", entry.getHotpSecret());
assertEquals(new Long(25), entry.getHotpCounter());
}
}

View file

@ -5,7 +5,6 @@
package com.zeapo.pwdstore
import android.net.Uri
import java.io.ByteArrayOutputStream
import java.io.UnsupportedEncodingException

View file

@ -35,8 +35,6 @@ import com.zeapo.pwdstore.git.GitActivity
import com.zeapo.pwdstore.utils.PasswordRepository
import com.zeapo.pwdstore.utils.auth.AuthenticationResult
import com.zeapo.pwdstore.utils.auth.Authenticator
import org.apache.commons.io.FileUtils
import org.openintents.openpgp.util.OpenPgpUtils
import java.io.File
import java.io.IOException
import java.time.LocalDateTime
@ -44,6 +42,8 @@ import java.time.format.DateTimeFormatter
import java.util.Calendar
import java.util.HashSet
import java.util.TimeZone
import org.apache.commons.io.FileUtils
import org.openintents.openpgp.util.OpenPgpUtils
typealias ClickListener = Preference.OnPreferenceClickListener
typealias ChangeListener = Preference.OnPreferenceChangeListener

View file

@ -14,9 +14,9 @@ import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.zeapo.pwdstore.PasswordStore
import com.zeapo.pwdstore.utils.splitLines
import org.eclipse.jgit.util.StringUtils
import java.util.ArrayList
import java.util.Arrays
import org.eclipse.jgit.util.StringUtils
// blank activity started by service for calling startIntentSenderForResult
class AutofillActivity : AppCompatActivity() {

View file

@ -30,11 +30,6 @@ import com.zeapo.pwdstore.PasswordEntry
import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.utils.PasswordRepository
import com.zeapo.pwdstore.utils.splitLines
import org.apache.commons.io.FileUtils
import org.openintents.openpgp.IOpenPgpService2
import org.openintents.openpgp.OpenPgpError
import org.openintents.openpgp.util.OpenPgpApi
import org.openintents.openpgp.util.OpenPgpServiceConnection
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.IOException
@ -44,6 +39,11 @@ import java.net.MalformedURLException
import java.net.URL
import java.util.ArrayList
import java.util.Locale
import org.apache.commons.io.FileUtils
import org.openintents.openpgp.IOpenPgpService2
import org.openintents.openpgp.OpenPgpError
import org.openintents.openpgp.util.OpenPgpApi
import org.openintents.openpgp.util.OpenPgpServiceConnection
class AutofillService : AccessibilityService() {
private var serviceConnection: OpenPgpServiceConnection? = null

View file

@ -40,6 +40,11 @@ import com.zeapo.pwdstore.PasswordGeneratorDialogFragment
import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.UserPreference
import com.zeapo.pwdstore.utils.Otp
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.Charset
import java.util.Date
import kotlinx.android.synthetic.main.decrypt_layout.*
import kotlinx.android.synthetic.main.encrypt_layout.crypto_extra_edit
import kotlinx.android.synthetic.main.encrypt_layout.crypto_password_category
@ -59,11 +64,6 @@ import org.openintents.openpgp.util.OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQU
import org.openintents.openpgp.util.OpenPgpApi.RESULT_ERROR
import org.openintents.openpgp.util.OpenPgpApi.RESULT_INTENT
import org.openintents.openpgp.util.OpenPgpServiceConnection
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.Charset
import java.util.Date
class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
private val clipboard: ClipboardManager by lazy {

View file

@ -7,11 +7,11 @@ package com.zeapo.pwdstore.git
import android.app.Activity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.zeapo.pwdstore.R
import java.io.File
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.GitCommand
import org.eclipse.jgit.api.PushCommand
import org.eclipse.jgit.api.RebaseCommand
import java.io.File
class BreakOutOfDetached(fileDir: File, callingActivity: Activity) : GitOperation(fileDir, callingActivity) {
private lateinit var commands: List<GitCommand<out Any>>

View file

@ -7,9 +7,9 @@ package com.zeapo.pwdstore.git
import android.app.Activity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.zeapo.pwdstore.R
import java.io.File
import org.eclipse.jgit.api.CloneCommand
import org.eclipse.jgit.api.Git
import java.io.File
/**
* Creates a new clone operation

View file

@ -27,11 +27,11 @@ import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.UserPreference
import com.zeapo.pwdstore.git.config.SshApiSessionFactory
import com.zeapo.pwdstore.utils.PasswordRepository
import org.apache.commons.io.FileUtils
import org.eclipse.jgit.lib.Constants
import java.io.File
import java.io.IOException
import java.util.regex.Pattern
import org.apache.commons.io.FileUtils
import org.eclipse.jgit.lib.Constants
open class GitActivity : AppCompatActivity() {
private lateinit var context: Context

View file

@ -24,11 +24,11 @@ import com.zeapo.pwdstore.git.config.GitConfigSessionFactory
import com.zeapo.pwdstore.git.config.SshApiSessionFactory
import com.zeapo.pwdstore.git.config.SshConfigSessionFactory
import com.zeapo.pwdstore.utils.PasswordRepository
import java.io.File
import org.eclipse.jgit.api.GitCommand
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.transport.SshSessionFactory
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider
import java.io.File
/**
* Creates a new git operation

View file

@ -7,9 +7,9 @@ package com.zeapo.pwdstore.git
import android.app.Activity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.zeapo.pwdstore.R
import java.io.File
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.PullCommand
import java.io.File
/**
* Creates a new git operation

View file

@ -7,9 +7,9 @@ package com.zeapo.pwdstore.git
import android.app.Activity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.zeapo.pwdstore.R
import java.io.File
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.PushCommand
import java.io.File
/**
* Creates a new git operation

View file

@ -7,11 +7,11 @@ package com.zeapo.pwdstore.git
import android.app.Activity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.zeapo.pwdstore.R
import java.io.File
import org.eclipse.jgit.api.AddCommand
import org.eclipse.jgit.api.FetchCommand
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.ResetCommand
import java.io.File
/**
* Creates a new git operation

View file

@ -7,13 +7,13 @@ package com.zeapo.pwdstore.git
import android.app.Activity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.zeapo.pwdstore.R
import java.io.File
import org.eclipse.jgit.api.AddCommand
import org.eclipse.jgit.api.CommitCommand
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.PullCommand
import org.eclipse.jgit.api.PushCommand
import org.eclipse.jgit.api.StatusCommand
import java.io.File
/**
* Creates a new git operation

View file

@ -6,7 +6,6 @@ package com.zeapo.pwdstore.pwgen
import android.content.Context
import com.zeapo.pwdstore.R
import java.util.ArrayList
object PasswordGenerator {

View file

@ -5,10 +5,8 @@
package com.zeapo.pwdstore.ui.adapters
import android.view.View
import com.zeapo.pwdstore.SelectFolderFragment
import com.zeapo.pwdstore.utils.PasswordItem
import java.util.ArrayList
class FolderRecyclerAdapter(

View file

@ -8,12 +8,10 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.appcompat.view.ActionMode
import com.zeapo.pwdstore.PasswordFragment
import com.zeapo.pwdstore.PasswordStore
import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.utils.PasswordItem
import java.util.ArrayList
import java.util.TreeSet

View file

@ -7,6 +7,9 @@ package com.zeapo.pwdstore.utils
import android.content.Context
import android.content.SharedPreferences
import androidx.preference.PreferenceManager
import java.io.File
import java.io.FileFilter
import java.util.Comparator
import org.apache.commons.io.filefilter.FileFilterUtils
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib.Repository
@ -14,9 +17,6 @@ import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.eclipse.jgit.transport.RefSpec
import org.eclipse.jgit.transport.RemoteConfig
import org.eclipse.jgit.transport.URIish
import java.io.File
import java.io.FileFilter
import java.util.Comparator
open class PasswordRepository protected constructor() {

View file

@ -3,4 +3,4 @@
android:shape="rectangle">
<size android:height="1dp" />
<solid android:color="?attr/colorPrimaryDark" />
</shape>
</shape>

View file

@ -9,4 +9,4 @@
</selector>
</item>
<item android:drawable="?attr/selectableItemBackground" />
</layer-list>
</layer-list>

View file

@ -21,4 +21,4 @@
android:top="8dp" />
</shape>
</item>
</layer-list>
</layer-list>

View file

@ -58,4 +58,4 @@
</LinearLayout>
</ScrollView>
</ScrollView>

View file

@ -33,4 +33,4 @@
android:layout_margin="@dimen/fab_compat_margin"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</RelativeLayout>

View file

@ -34,4 +34,4 @@
android:textColor="?android:attr/textColor" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -84,4 +84,4 @@
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -80,4 +80,4 @@
</RadioGroup>
</LinearLayout>
</LinearLayout>

View file

@ -25,4 +25,4 @@
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
</ScrollView>

View file

@ -70,4 +70,4 @@
android:text="@string/ssh_keygen_generate" />
</LinearLayout>
</ScrollView>
</ScrollView>

View file

@ -29,4 +29,4 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sshkey_passphrase" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -16,4 +16,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -8,4 +8,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
</LinearLayout>
</LinearLayout>

View file

@ -9,4 +9,4 @@
pwstore:actionViewClass="androidx.appcompat.widget.SearchView"
pwstore:showAsAction="ifRoom|collapseActionView"/>
</menu>
</menu>

View file

@ -22,4 +22,3 @@
app:showAsAction="ifRoom" />
</menu>

View file

@ -28,4 +28,3 @@
android:title="@string/action_settings"
android:orderInCategory="100"/>
</menu>

View file

@ -8,4 +8,4 @@
pwstore:showAsAction="ifRoom"
android:id="@+id/crypto_select"
/>
</menu>
</menu>

View file

@ -2,4 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
</adaptive-icon>

View file

@ -2,4 +2,4 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
</adaptive-icon>

View file

@ -148,4 +148,4 @@
<string name="send_plaintext_password_to">Odeslat heslo jako plaintext za použití…</string>
<string name="show_password">Pokaż hasło</string>
<string name="get_last_changed_failed">Failed to get last changed date</string>
</resources>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="fab_compat_margin">16dp</dimen>
</resources>
</resources>

View file

@ -19,4 +19,4 @@
<item>FILE_FIRST</item>
<item>INDEPENDENT</item>
</string-array>
</resources>
</resources>

View file

@ -6,4 +6,4 @@
<declare-styleable name="Multiselected">
<attr name="state_multiselected" format="boolean"/>
</declare-styleable>
</resources>
</resources>

View file

@ -6,4 +6,4 @@
android:accessibilityFeedbackType="feedbackGeneric"
android:notificationTimeout="100"
android:canRetrieveWindowContent="true"
/>
/>