corrected a nasty bug, resolves #18

This commit is contained in:
knuthy 2014-10-01 11:13:40 +02:00
parent cc2883fe1b
commit 7264494a02
4 changed files with 10 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View file

@ -98,7 +98,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
return true;
case R.id.menu_add_password:
if (PasswordRepository.isInitialized()) {
if (!PasswordRepository.isInitialized()) {
initBefore.show();
break;
}
@ -110,7 +110,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
// break;
case R.id.git_push:
if (PasswordRepository.isInitialized()) {
if (!PasswordRepository.isInitialized()) {
initBefore.show();
break;
}
@ -122,7 +122,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
return true;
case R.id.git_pull:
if (PasswordRepository.isInitialized()) {
if (!PasswordRepository.isInitialized()) {
initBefore.show();
break;
}
@ -250,12 +250,14 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
case 0:
if(!localDir.equals(PasswordRepository.getWorkTree()))
break;
PasswordRepository.setInitialized(false);
ToCloneOrNot cloneFrag = new ToCloneOrNot();
fragmentTransaction.replace(R.id.main_layout, cloneFrag, "ToCloneOrNot");
fragmentTransaction.commit();
break;
default:
PasswordRepository.setInitialized(true);
PasswordFragment passFrag = new PasswordFragment();
Bundle args = new Bundle();
args.putString("Path", localDir.getAbsolutePath());

View file

@ -38,7 +38,6 @@ public class PasswordRepository {
.readEnvironment()
.findGitDir()
.build();
initialized = true;
} catch (Exception e) {
e.printStackTrace();
return null;
@ -51,6 +50,10 @@ public class PasswordRepository {
return initialized;
}
public static void setInitialized(boolean v) {
initialized = v;
}
public static void createRepository(File localDir) {
localDir.delete();
@ -71,6 +74,7 @@ public class PasswordRepository {
.setName("master")
.call();
initialized = true;
} catch (Exception e) {
e.printStackTrace();
return;