aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorZeapo <mohamed@zenadi.com>2014-08-06 23:44:34 +0100
committerZeapo <mohamed@zenadi.com>2014-08-06 23:44:34 +0100
commitc2f520f7bf7b699d15db4cf8c6c28725cb834243 (patch)
tree858b91ac831d3f8f4f1817ad13d97cd0c0a796bb /app/src/main/java
parentad7b05114434494323dd078b0bd221608609a680 (diff)
some refactoring and improved the creation so that it happens on the visible dir
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
index 5f5d3d16..500971d3 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -9,6 +9,7 @@ import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -53,7 +54,6 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
@Override
public void onPause() {
super.onPause();
- this.leftActivity = true;
}
@Override
@@ -88,11 +88,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
break;
case R.id.referesh:
- PasswordFragment plist;
- if (null !=
- (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
- plist.updateAdapter();
- }
+ refreshListAdapter();
return true;
@@ -122,15 +118,17 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
}
private void checkLocalRepository(File localDir) {
+ FragmentManager fragmentManager = getFragmentManager();
+ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+
// if we are coming back from gpg do not anything
- if (this.leftActivity)
+ if (this.leftActivity) {
+ this.leftActivity = false;
return;
+ }
int status = 0;
- FragmentManager fragmentManager = getFragmentManager();
- FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
-
if (localDir.exists()) {
File[] folders = localDir.listFiles();
status = folders.length;
@@ -166,7 +164,6 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
}
this.leftActivity = false;
- this.currentDir = localDir;
}
/** Stack the positions the different fragments were at */
@@ -205,7 +202,8 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
}
public void createPassword(View v) {
- System.out.println("Adding file to : " + this.currentDir.getAbsolutePath());
+ this.currentDir = new File(((PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList")).getArguments().getString("Path"));
+ Log.i("PWDSTR", "Adding file to : " + this.currentDir.getAbsolutePath());
this.leftActivity = true;
try {
@@ -220,10 +218,18 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
}
}
+ private void refreshListAdapter() {
+ PasswordFragment plist;
+ if (null !=
+ (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) {
+ plist.updateAdapter();
+ }
+ }
+
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
- System.out.println(resultCode);
- if (resultCode == RESULT_OK)
- checkLocalRepository(this.currentDir);
+ if (resultCode == RESULT_OK) {
+ refreshListAdapter();
+ }
}
}