diff --git a/.idea/libraries/support_v4_19_1_0.xml b/.idea/libraries/support_v4_19_1_0.xml deleted file mode 100644 index 8ccc0a75..00000000 --- a/.idea/libraries/support_v4_19_1_0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/app.iml b/app/app.iml index ddcb0a8d..1defa8a4 100644 --- a/app/app.iml +++ b/app/app.iml @@ -63,7 +63,6 @@ - diff --git a/app/build.gradle b/app/build.gradle index 8e039e21..82bf9fbb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,6 +24,4 @@ dependencies { compile project(':libraries:openpgp-api-lib') compile 'org.eclipse.jgit:org.eclipse.jgit:3.4.+' compile 'org.apache.commons:commons-io:1.3.2' - // You must install or update the Support Repository through the SDK manager to use this dependency. - compile 'com.android.support:support-v4:19.+' } 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) { - // if we are coming back from gpg do not anything - if (this.leftActivity) - return; - - int status = 0; - FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + // if we are coming back from gpg do not anything + if (this.leftActivity) { + this.leftActivity = false; + return; + } + + int status = 0; + 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(); + } } }