From 3f1caf89aa21b710ece3702f0217897baf8afe3a Mon Sep 17 00:00:00 2001 From: zeapo Date: Sat, 6 Dec 2014 18:03:43 +0100 Subject: Added preference to disable recursive filtering --- app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/com') diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java index 67fe79a6..b2e06a1b 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java @@ -2,9 +2,11 @@ package com.zeapo.pwdstore; import android.app.Activity; import android.content.Intent; +import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.app.Fragment; +import android.preference.PreferenceManager; import android.support.v7.app.ActionBarActivity; import android.support.v7.internal.widget.AdapterViewCompat; import android.support.v7.widget.LinearLayoutManager; @@ -47,6 +49,7 @@ public class PasswordFragment extends Fragment{ private RecyclerView recyclerView; private RecyclerView.LayoutManager mLayoutManager; private OnFragmentInteractionListener mListener; + private SharedPreferences settings; /** * Mandatory empty constructor for the fragment manager to instantiate the @@ -60,6 +63,7 @@ public class PasswordFragment extends Fragment{ String path = getArguments().getString("Path"); + settings = PreferenceManager.getDefaultSharedPreferences(getActivity()); passListStack = new Stack>(); scrollPosition = new Stack(); pathStack = new Stack(); @@ -175,8 +179,9 @@ public class PasswordFragment extends Fragment{ PasswordRepository.getPasswords() : PasswordRepository.getPasswords(dir); + boolean rec = settings.getBoolean("filter_recursively", true); for (PasswordItem item : passwordItems) { - if (item.getType() == PasswordItem.TYPE_CATEGORY) { + if (item.getType() == PasswordItem.TYPE_CATEGORY && rec) { recursiveFilter(filter, item.getFile()); } boolean matches = item.toString().toLowerCase().contains(filter.toLowerCase()); -- cgit v1.2.3