aboutsummaryrefslogtreecommitdiff
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/SelectFolderActivity.kt2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt26
2 files changed, 11 insertions, 17 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/SelectFolderActivity.kt b/app/src/main/java/com/zeapo/pwdstore/SelectFolderActivity.kt
index 04ff95b4..0a6dfcf6 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SelectFolderActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/SelectFolderActivity.kt
@@ -27,7 +27,7 @@ class SelectFolderActivity : AppCompatActivity() {
passwordList = SelectFolderFragment()
val args = Bundle()
- args.putString("Path", PasswordRepository.getRepositoryDirectory(applicationContext)?.absolutePath)
+ args.putString("Path", PasswordRepository.getRepositoryDirectory(applicationContext).absolutePath)
passwordList.arguments = args
diff --git a/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt b/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt
index 2668517b..8b1d856b 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/SelectFolderFragment.kt
@@ -38,21 +38,15 @@ import java.util.Stack
class SelectFolderFragment : Fragment() {
// store the pass files list in a stack
- private lateinit var pathStack: Stack<File>
+ private var pathStack: Stack<File> = Stack()
private lateinit var recyclerAdapter: FolderRecyclerAdapter
private lateinit var recyclerView: RecyclerView
- private lateinit var mListener: OnFragmentInteractionListener
+ private lateinit var listener: OnFragmentInteractionListener
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- val path = requireArguments().getString("Path")
- pathStack = Stack()
- recyclerAdapter = FolderRecyclerAdapter(
- mListener,
- getPasswords(
- File(path),
- getRepositoryDirectory(requireActivity())!!,
- sortOrder))
+ val path = requireNotNull(requireArguments().getString("Path"))
+ recyclerAdapter = FolderRecyclerAdapter(listener, getPasswords(File(path), getRepositoryDirectory(requireActivity()), sortOrder))
}
override fun onCreateView(
@@ -78,18 +72,18 @@ class SelectFolderFragment : Fragment() {
override fun onAttach(context: Context) {
super.onAttach(context)
try {
- mListener = object : OnFragmentInteractionListener {
+ listener = object : OnFragmentInteractionListener {
override fun onFragmentInteraction(item: PasswordItem) {
if (item.type == PasswordItem.TYPE_CATEGORY) {
// push the category were we're going
pathStack.push(item.file)
recyclerView.scrollToPosition(0)
recyclerAdapter.clear()
- recyclerAdapter.addAll(
- getPasswords(
- item.file,
- getRepositoryDirectory(context)!!,
- sortOrder))
+ recyclerAdapter.addAll(getPasswords(
+ item.file,
+ getRepositoryDirectory(context),
+ sortOrder)
+ )
(requireActivity() as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
}