Merge remote-tracking branch 'origin/master' into v/eventbus

This commit is contained in:
Vincent Breitmoser 2015-06-10 14:49:02 +02:00
commit 9b6416943b
3 changed files with 32 additions and 5 deletions

View File

@ -263,7 +263,7 @@ public class ImportKeysActivity extends BaseNfcActivity {
// However, if we're being restored from a previous state, // However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else // then we don't need to do anything and should return or else
// we could end up with overlapping fragments. // we could end up with overlapping fragments.
if (savedInstanceState != null) { if (mListFragment != null) {
return; return;
} }
@ -283,7 +283,7 @@ public class ImportKeysActivity extends BaseNfcActivity {
// However, if we're being restored from a previous state, // However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else // then we don't need to do anything and should return or else
// we could end up with overlapping fragments. // we could end up with overlapping fragments.
if (savedInstanceState != null) { if (mTopFragment != null) {
return; return;
} }
@ -314,7 +314,7 @@ public class ImportKeysActivity extends BaseNfcActivity {
// However, if we're being restored from a previous state, // However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else // then we don't need to do anything and should return or else
// we could end up with overlapping fragments. // we could end up with overlapping fragments.
if (savedInstanceState != null) { if (mTopFragment != null) {
return; return;
} }

View File

@ -23,6 +23,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentManager.OnBackStackChangedListener;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
@ -42,7 +43,7 @@ import org.sufficientlysecure.keychain.ui.base.BaseNfcActivity;
import org.sufficientlysecure.keychain.util.FabContainer; import org.sufficientlysecure.keychain.util.FabContainer;
import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.Preferences;
public class MainActivity extends BaseNfcActivity implements FabContainer { public class MainActivity extends BaseNfcActivity implements FabContainer, OnBackStackChangedListener {
private static final int ID_KEYS = 1; private static final int ID_KEYS = 1;
private static final int ID_ENCRYPT_DECRYPT = 2; private static final int ID_ENCRYPT_DECRYPT = 2;
@ -121,6 +122,8 @@ public class MainActivity extends BaseNfcActivity implements FabContainer {
return; return;
} }
getSupportFragmentManager().addOnBackStackChangedListener(this);
Intent data = getIntent(); Intent data = getIntent();
// If we got an EXTRA_RESULT in the intent, show the notification // If we got an EXTRA_RESULT in the intent, show the notification
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) { if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
@ -206,4 +209,25 @@ public class MainActivity extends BaseNfcActivity implements FabContainer {
} }
@Override
public void onBackStackChanged() {
FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager == null) {
return;
}
Fragment frag = fragmentManager.findFragmentById(R.id.main_fragment_container);
if (frag == null) {
return;
}
// make sure the selected icon is the one shown at this point
if (frag instanceof KeyListFragment) {
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_KEYS), false);
} else if (frag instanceof EncryptDecryptOverviewFragment) {
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_ENCRYPT_DECRYPT), false);
} else if (frag instanceof AppsListFragment) {
mDrawerResult.setSelection(mDrawerResult.getPositionFromIdentifier(ID_APPS), false);
}
}
} }

View File

@ -52,7 +52,10 @@ However, scanning a QR code, receiving a key via NFC, or exchanging keys via Saf
## Can I mark public keys as trusted without certifying them with my own key? ## Can I mark public keys as trusted without certifying them with my own key?
No. You can, however, simply create a new key just for certification, which will essentially be the same thing. No. You can, however, simply create a new key just for certification, which will essentially be the same thing.
## I see no suitable option in the app selection menu when trying to open a local file, what's wrong?
You probably don't have any stand-alone file managers installed, like [OI File Manager](https://f-droid.org/repository/browse/?fdid=org.openintents.filemanager) or [Amaze](https://f-droid.org/repository/browse/?fdid=com.amaze.filemanager). OpenKeychain needs one in order to select files from local storage or SD card, such as for importing keys or encrypting/decrypting files.
# Avanced Questions # Avanced Questions