mirror of
https://github.com/android-password-store/Android-Password-Store.git
synced 2025-09-07 16:09:38 +02:00
uniforming passwordfragment instances
This commit is contained in:
parent
8c2c4c3b24
commit
f389904160
|
@ -38,6 +38,7 @@ public class PasswordStore extends ActionBarActivity {
|
||||||
private File currentDir;
|
private File currentDir;
|
||||||
private SharedPreferences settings;
|
private SharedPreferences settings;
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
|
private PasswordFragment plist;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -302,15 +303,15 @@ public class PasswordStore extends ActionBarActivity {
|
||||||
|
|
||||||
if (fragmentManager.findFragmentByTag("PasswordsList") == null) {
|
if (fragmentManager.findFragmentByTag("PasswordsList") == null) {
|
||||||
PasswordRepository.setInitialized(true);
|
PasswordRepository.setInitialized(true);
|
||||||
PasswordFragment passFrag = new PasswordFragment();
|
plist = new PasswordFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString("Path", localDir.getAbsolutePath());
|
args.putString("Path", localDir.getAbsolutePath());
|
||||||
|
|
||||||
passFrag.setArguments(args);
|
plist.setArguments(args);
|
||||||
|
|
||||||
fragmentTransaction.addToBackStack("passlist");
|
fragmentTransaction.addToBackStack("passlist");
|
||||||
|
|
||||||
fragmentTransaction.replace(R.id.main_layout, passFrag, "PasswordsList");
|
fragmentTransaction.replace(R.id.main_layout, plist, "PasswordsList");
|
||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,9 +323,7 @@ public class PasswordStore extends ActionBarActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
PasswordFragment plist;
|
if ((null != plist) && plist.isNotEmpty()) {
|
||||||
if ((null != (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) &&
|
|
||||||
plist.isNotEmpty()) {
|
|
||||||
plist.popBack();
|
plist.popBack();
|
||||||
} else {
|
} else {
|
||||||
super.onBackPressed();
|
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
|
* clears adapter's content and updates it with a fresh list of passwords from the root
|
||||||
*/
|
*/
|
||||||
public void updateListAdapter() {
|
public void updateListAdapter() {
|
||||||
PasswordFragment plist;
|
if ((null != plist)) {
|
||||||
if (null !=
|
|
||||||
(plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
|
|
||||||
plist.updateAdapter();
|
plist.updateAdapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,25 +410,19 @@ public class PasswordStore extends ActionBarActivity {
|
||||||
* Updates the adapter with the current view of passwords
|
* Updates the adapter with the current view of passwords
|
||||||
*/
|
*/
|
||||||
public void refreshListAdapter() {
|
public void refreshListAdapter() {
|
||||||
PasswordFragment plist;
|
if ((null != plist)) {
|
||||||
if (null !=
|
|
||||||
(plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
|
|
||||||
plist.refreshAdapter();
|
plist.refreshAdapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void filterListAdapter(String filter) {
|
public void filterListAdapter(String filter) {
|
||||||
PasswordFragment plist;
|
if ((null != plist)) {
|
||||||
if (null !=
|
|
||||||
(plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
|
|
||||||
plist.filterAdapter(filter);
|
plist.filterAdapter(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getCurrentDir() {
|
private File getCurrentDir() {
|
||||||
PasswordFragment plist;
|
if ((null != plist)) {
|
||||||
if (null !=
|
|
||||||
(plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
|
|
||||||
return plist.getCurrentDir();
|
return plist.getCurrentDir();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue