Merge pull request #366 from uberspot/master

Minor code clean up
This commit is contained in:
Dominik Schürmann
2014-03-07 22:39:53 +01:00
34 changed files with 38 additions and 63 deletions

View File

@@ -249,7 +249,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
finish();
}
}
};
}
};
// Create a new Messenger for the communication back
@@ -295,7 +295,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements
setResult(RESULT_OK);
finish();
}
};
}
};
// Create a new Messenger for the communication back

View File

@@ -744,8 +744,6 @@ public class DecryptActivity extends DrawerActivity {
}
}
}
;
};
// Create a new Messenger for the communication back

View File

@@ -224,7 +224,7 @@ public class EditKeyActivity extends ActionBarActivity {
buildLayout();
}
};
}
};
// Create a new Messenger for the communication back
@@ -561,7 +561,7 @@ public class EditKeyActivity extends ActionBarActivity {
setResult(RESULT_OK, data);
finish();
}
};
}
};
// Create a new Messenger for the communication back

View File

@@ -669,8 +669,6 @@ public class EncryptActivity extends DrawerActivity {
}
}
}
;
};
// Create a new Messenger for the communication back

View File

@@ -22,16 +22,11 @@ import java.util.ArrayList;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.ui.adapter.TabsAdapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.widget.TextView;
public class HelpActivity extends ActionBarActivity {
public static final String EXTRA_SELECTED_TAB = "selectedTab";
@@ -64,19 +59,19 @@ public class HelpActivity extends ActionBarActivity {
Bundle startBundle = new Bundle();
startBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_start);
mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_start)),
HelpHtmlFragment.class, startBundle, (selectedTab == 0 ? true : false));
HelpHtmlFragment.class, startBundle, (selectedTab == 0) );
Bundle nfcBundle = new Bundle();
nfcBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_nfc_beam);
mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_nfc_beam)),
HelpHtmlFragment.class, nfcBundle, (selectedTab == 1 ? true : false));
HelpHtmlFragment.class, nfcBundle, (selectedTab == 1) );
Bundle changelogBundle = new Bundle();
changelogBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_changelog);
mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_changelog)),
HelpHtmlFragment.class, changelogBundle, (selectedTab == 2 ? true : false));
HelpHtmlFragment.class, changelogBundle, (selectedTab == 2) );
mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_about)),
HelpAboutFragment.class, null, (selectedTab == 3 ? true : false));
HelpAboutFragment.class, null, (selectedTab == 3) );
}
}

View File

@@ -25,7 +25,6 @@ import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.ui.widget.IntegerListPreference;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
@@ -57,7 +56,6 @@ public class PreferencesActivity extends PreferenceActivity {
// actionBar.setDisplayHomeAsUpEnabled(false);
// actionBar.setHomeButtonEnabled(false);
//addPreferencesFromResource(R.xml.preferences);
String action = getIntent().getAction();
if (action != null && action.equals(ACTION_PREFS_GEN)) {

View File

@@ -113,7 +113,7 @@ public class UploadKeyActivity extends ActionBarActivity {
Toast.LENGTH_SHORT).show();
finish();
}
};
}
};
// Create a new Messenger for the communication back

View File

@@ -88,12 +88,12 @@ public class ViewKeyActivity extends ActionBarActivity {
Bundle mainBundle = new Bundle();
mainBundle.putParcelable(ViewKeyMainFragment.ARG_DATA_URI, mDataUri);
mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.key_view_tab_main)),
ViewKeyMainFragment.class, mainBundle, (selectedTab == 0 ? true : false));
ViewKeyMainFragment.class, mainBundle, (selectedTab == 0));
Bundle certBundle = new Bundle();
certBundle.putParcelable(ViewKeyCertsFragment.ARG_DATA_URI, mDataUri);
mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.key_view_tab_certs)),
ViewKeyCertsFragment.class, certBundle, (selectedTab == 1 ? true : false));
ViewKeyCertsFragment.class, certBundle, (selectedTab == 1));
}
@Override

View File

@@ -152,9 +152,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
// selected is default
this.selected = true;
if (pgpKeyRing instanceof PGPSecretKeyRing) {
secretKey = true;
} else {
if ( !(pgpKeyRing instanceof PGPSecretKeyRing) ) {
secretKey = false;
}

View File

@@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.ui.adapter;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.spongycastle.openpgp.PGPKeyRing;
import org.spongycastle.openpgp.PGPObjectFactory;
@@ -88,7 +87,7 @@ public class ImportKeysListLoader extends AsyncTaskLoader<AsyncTaskResultWrapper
/**
* Reads all PGPKeyRing objects from input
*
* @param keyringBytes
* @param inputData
* @return
*/
private void generateListOfKeyrings(InputData inputData) {

View File

@@ -36,7 +36,6 @@ import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**

View File

@@ -95,7 +95,7 @@ public class DeleteFileDialogFragment extends DialogFragment {
Toast.makeText(activity, R.string.file_delete_successful,
Toast.LENGTH_SHORT).show();
}
};
}
};
// Create a new Messenger for the communication back

View File

@@ -33,7 +33,6 @@ import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.support.v4.app.DialogFragment;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;

View File

@@ -158,7 +158,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
PGPSecretKey clickSecretKey = secretKey;
if (clickSecretKey != null) {
while (keyOK == true) {
while (keyOK) {
if (clickSecretKey != null) { // check again for loop
try {
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder()
@@ -207,7 +207,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
// cache the new passphrase
Log.d(Constants.TAG, "Everything okay! Caching entered passphrase");
PassphraseCacheService.addCachedPassphrase(activity, keyId, passphrase);
if (keyOK == false && clickSecretKey.getKeyID() != keyId) {
if ( !keyOK && clickSecretKey.getKeyID() != keyId) {
PassphraseCacheService.addCachedPassphrase(activity, clickSecretKey.getKeyID(),
passphrase);
}

View File

@@ -261,7 +261,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
.getByteArray(KeychainIntentService.RESULT_NEW_KEY));
addGeneratedKeyToView(newKey);
}
};
}
};
// Create a new Messenger for the communication back