aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeapo <mohamed@zenadi.com>2014-10-30 22:38:56 +0100
committerzeapo <mohamed@zenadi.com>2014-10-30 22:38:56 +0100
commitf3899041603293acf615d4d4349e6871c971d810 (patch)
tree627c3f735e7bdeaa0150e7ab9b298de01f6d9697
parent8c2c4c3b248ae5148a5904398d6ee4fdb72aab17 (diff)
uniforming passwordfragment instances
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java27
1 files changed, 9 insertions, 18 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
index d3f75565..3788dfc1 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -38,6 +38,7 @@ public class PasswordStore extends ActionBarActivity {
private File currentDir;
private SharedPreferences settings;
private Activity activity;
+ private PasswordFragment plist;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -302,15 +303,15 @@ public class PasswordStore extends ActionBarActivity {
if (fragmentManager.findFragmentByTag("PasswordsList") == null) {
PasswordRepository.setInitialized(true);
- PasswordFragment passFrag = new PasswordFragment();
+ plist = new PasswordFragment();
Bundle args = new Bundle();
args.putString("Path", localDir.getAbsolutePath());
- passFrag.setArguments(args);
+ plist.setArguments(args);
fragmentTransaction.addToBackStack("passlist");
- fragmentTransaction.replace(R.id.main_layout, passFrag, "PasswordsList");
+ fragmentTransaction.replace(R.id.main_layout, plist, "PasswordsList");
fragmentTransaction.commit();
}
}
@@ -322,9 +323,7 @@ public class PasswordStore extends ActionBarActivity {
@Override
public void onBackPressed() {
- PasswordFragment plist;
- if ((null != (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) &&
- plist.isNotEmpty()) {
+ if ((null != plist) && plist.isNotEmpty()) {
plist.popBack();
} else {
super.onBackPressed();
@@ -402,9 +401,7 @@ public class PasswordStore extends ActionBarActivity {
* clears adapter's content and updates it with a fresh list of passwords from the root
*/
public void updateListAdapter() {
- PasswordFragment plist;
- if (null !=
- (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
+ if ((null != plist)) {
plist.updateAdapter();
}
}
@@ -413,25 +410,19 @@ public class PasswordStore extends ActionBarActivity {
* Updates the adapter with the current view of passwords
*/
public void refreshListAdapter() {
- PasswordFragment plist;
- if (null !=
- (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
+ if ((null != plist)) {
plist.refreshAdapter();
}
}
public void filterListAdapter(String filter) {
- PasswordFragment plist;
- if (null !=
- (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
+ if ((null != plist)) {
plist.filterAdapter(filter);
}
}
private File getCurrentDir() {
- PasswordFragment plist;
- if (null !=
- (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
+ if ((null != plist)) {
return plist.getCurrentDir();
}
return null;