ensuring code style is preserved

This commit is contained in:
Adithya Abraham Philip
2015-06-16 14:36:18 +05:30
parent f6d0f88ac9
commit 2402c6d3c7
23 changed files with 112 additions and 146 deletions

View File

@@ -131,7 +131,7 @@ public class CreateYubiKeyImportFragment
}
};
if(OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs,
getActivity())) {
importKey(proxyPrefs.parcelableProxy);
}

View File

@@ -46,7 +46,6 @@ import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
import java.io.IOException;
import java.net.Proxy;
import java.util.ArrayList;
public class ImportKeysActivity extends BaseNfcActivity
@@ -322,7 +321,8 @@ public class ImportKeysActivity extends BaseNfcActivity
* specified in user preferences
*/
private void startCloudFragment(Bundle savedInstanceState, String query, boolean disableQueryEdit, String keyserver) {
private void startCloudFragment(Bundle savedInstanceState, String query, boolean disableQueryEdit, String
keyserver) {
// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.

View File

@@ -51,6 +51,8 @@ import android.widget.TextView;
import com.getbase.floatingactionbutton.FloatingActionButton;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
@@ -81,10 +83,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
/**
* Public key list with sticky list headers. It does _not_ exte
/**
* Public key list with sticky list headers. It does _not_ extend ListFragment because it uses
* StickyListHeaders library which does not extend upon ListView.
@@ -472,15 +472,13 @@ public class KeyListFragment extends LoaderFragment
return true;
case R.id.menu_key_list_export:
mExportHelper.showExportKeysDialog(null, Constants.Path.APP_DIR_FILE, true);
);
return true;
case R.id.menu_key_list_update_all_keys:
updateAllKeys();
return true;
case R.id.menu_key_list_debug
_cons return true;
case R.id.menu_key_list_debug_cons:
consolidate();
consolidate(case R.id.menu_key_list_debug_cons:);
return true;
case R.id.menu_key_list_debug_read:

View File

@@ -245,7 +245,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
}
public Preference automaticallyFindPreference(String key) {
if(mFragment != null) {
if (mFragment != null) {
return mFragment.findPreference(key);
} else {
return mActivity.findPreference(key);
@@ -259,8 +259,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
Preferences.setPreferenceManagerFileAndMode(mFragment.getPreferenceManager());
// Load the preferences from an XML resource
mFragment.addPreferencesFromResource(R.xml.proxy_prefs);
}
else {
} else {
Preferences.setPreferenceManagerFileAndMode(mActivity.getPreferenceManager());
// Load the preferences from an XML resource
mActivity.addPreferencesFromResource(R.xml.proxy_prefs);
@@ -285,7 +284,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Activity activity = mFragment != null ? mFragment.getActivity() : mActivity;
if ((Boolean)newValue) {
if ((Boolean) newValue) {
boolean installed = OrbotHelper.isOrbotInstalled(activity);
if (!installed) {
Log.d(Constants.TAG, "Prompting to install Tor");
@@ -298,8 +297,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
// let the enable tor box be checked
return true;
}
}
else {
} else {
// we're unchecking Tor, so enable other proxy
enableNormalProxyPrefs();
return true;
@@ -350,7 +348,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
Activity activity = mFragment != null ? mFragment.getActivity() : mActivity;
try {
int port = Integer.parseInt((String) newValue);
if(port < 0 || port > 65535) {
if (port < 0 || port > 65535) {
Notify.create(
activity,
R.string.pref_proxy_port_err_invalid,

View File

@@ -53,7 +53,6 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.getbase.floatingactionbutton.FloatingActionButton;
import edu.cmu.cylab.starslinger.exchange.ExchangeActivity;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
@@ -81,6 +80,13 @@ import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.ActionListener;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.ui.util.QrCodeUtils;
import org.sufficientlysecure.keychain.util.ContactHelper;
import org.sufficientlysecure.keychain.util.ExportHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.NfcHelper;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
import java.io.IOException;
import java.util.ArrayList;
@@ -460,11 +466,11 @@ public class ViewKeyActivity extends BaseNfcActivity implements
HashMap<String, Object> data = providerHelper.getGenericData(
baseUri,
new String[] {KeychainContract.Keys.MASTER_KEY_ID, KeychainContract.KeyRings.HAS_SECRET},
new int[] {ProviderHelper.FIELD_TYPE_INTEGER, ProviderHelper.FIELD_TYPE_INTEGER});
new String[]{KeychainContract.Keys.MASTER_KEY_ID, KeychainContract.KeyRings.HAS_SECRET},
new int[]{ProviderHelper.FIELD_TYPE_INTEGER, ProviderHelper.FIELD_TYPE_INTEGER});
exportHelper.showExportKeysDialog(
new long[] {(Long) data.get(KeychainContract.KeyRings.MASTER_KEY_ID)},
new long[]{(Long) data.get(KeychainContract.KeyRings.MASTER_KEY_ID)},
Constants.Path.APP_DIR_FILE, ((Long) data.get(KeychainContract.KeyRings.HAS_SECRET) != 0)
);
} catch (ProviderHelper.NotFoundException e) {
@@ -488,7 +494,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
// Create a new Messenger for the communication back
Messenger messenger = new Messenger(returnHandler);
DeleteKeyDialogFragment deleteKeyDialog = DeleteKeyDialogFragment.newInstance(messenger,
new long[] {mMasterKeyId});
new long[]{mMasterKeyId});
deleteKeyDialog.show(getSupportFragmentManager(), "deleteKeyDialog");
}
@@ -632,7 +638,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
long keyId = new ProviderHelper(this)
.getCachedPublicKeyRing(dataUri)
.extractOrGetMasterKeyId();
long[] encryptionKeyIds = new long[] {keyId};
long[] encryptionKeyIds = new long[]{keyId};
Intent intent;
if (text) {
intent = new Intent(this, EncryptTextActivity.class);
@@ -738,7 +744,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements
// These are the rows that we will retrieve.
static final String[] PROJECTION = new String[] {
static final String[] PROJECTION = new String[]{
KeychainContract.KeyRings._ID,
KeychainContract.KeyRings.MASTER_KEY_ID,
KeychainContract.KeyRings.USER_ID,
@@ -826,7 +832,8 @@ public class ViewKeyActivity extends BaseNfcActivity implements
AsyncTask<Long, Void, Bitmap> photoTask =
new AsyncTask<Long, Void, Bitmap>() {
protected Bitmap doInBackground(Long... mMasterKeyId) {
return ContactHelper.loadPhotoByMasterKeyId(getContentResolver(), mMasterKeyId[0], true);
return ContactHelper.loadPhotoByMasterKeyId(getContentResolver(),
mMasterKeyId[0], true);
}
protected void onPostExecute(Bitmap photo) {

View File

@@ -55,7 +55,6 @@ import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
@@ -201,7 +200,8 @@ public class ViewKeyTrustFragment extends LoaderFragment implements
mStartSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(getActivity()).getProxyPrefs();
final Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(getActivity())
.getProxyPrefs();
Runnable ignoreTor = new Runnable() {
@Override

View File

@@ -30,7 +30,6 @@ import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ParcelableProxy;
import org.sufficientlysecure.keychain.util.Preferences;
import java.net.Proxy;
import java.util.ArrayList;
public class ImportKeysListCloudLoader

View File

@@ -59,14 +59,13 @@ import org.sufficientlysecure.keychain.util.TlsHelper;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
import java.net.*;
import javax.net.ssl.HttpsURLConnection;
public class AddEditKeyserverDialogFragment extends DialogFragment implements OnEditorActionListener {
private static final String ARG_MESSENGER = "arg_messenger";

View File

@@ -48,15 +48,16 @@ public class InstallDialogFragment extends DialogFragment {
* Creates a dialog which prompts the user to install an application. Consists of two default buttons ("Install"
* and "Cancel") and an optional third button. Callbacks are provided only for the middle button, if set.
*
* @param messenger required only for callback from middle button if it has been set
* @param messenger required only for callback from middle button if it has been set
* @param title
* @param message content of dialog
* @param message content of dialog
* @param packageToInstall package name of application to install
* @param middleButton if not null, adds a third button to the app with a call back
* @param middleButton if not null, adds a third button to the app with a call back
* @return The dialog to display
*/
public static InstallDialogFragment newInstance(Messenger messenger, int title, int message,
String packageToInstall, int middleButton, boolean useMiddleButton) {
String packageToInstall, int middleButton, boolean
useMiddleButton) {
InstallDialogFragment frag = new InstallDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_MESSENGER, messenger);
@@ -125,7 +126,7 @@ public class InstallDialogFragment extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
Message msg = new Message();
msg.what=MESSAGE_MIDDLE_CLICKED;
msg.what = MESSAGE_MIDDLE_CLICKED;
try {
messenger.send(msg);
} catch (RemoteException e) {

View File

@@ -25,6 +25,7 @@ import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.support.v4.app.DialogFragment;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Log;

View File

@@ -27,6 +27,7 @@ import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.app.DialogFragment;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Log;
@@ -47,15 +48,16 @@ public class PreferenceInstallDialogFragment extends DialogFragment {
* Creates a dialog which prompts the user to install an application. Consists of two default buttons ("Install"
* and "Cancel") and an optional third button. Callbacks are provided only for the middle button, if set.
*
* @param messenger required only for callback from middle button if it has been set
* @param messenger required only for callback from middle button if it has been set
* @param title
* @param message content of dialog
* @param message content of dialog
* @param packageToInstall package name of application to install
* @param middleButton if not null, adds a third button to the app with a call back
* @param middleButton if not null, adds a third button to the app with a call back
* @return The dialog to display
*/
public static PreferenceInstallDialogFragment newInstance(Messenger messenger, int title, int message,
String packageToInstall, int middleButton, boolean useMiddleButton) {
String packageToInstall, int middleButton, boolean
useMiddleButton) {
PreferenceInstallDialogFragment frag = new PreferenceInstallDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_MESSENGER, messenger);
@@ -80,7 +82,7 @@ public class PreferenceInstallDialogFragment extends DialogFragment {
* @return
*/
public static PreferenceInstallDialogFragment newInstance(int title, int message,
String packageToInstall) {
String packageToInstall) {
return newInstance(null, title, message, packageToInstall, -1, false);
}
@@ -125,7 +127,7 @@ public class PreferenceInstallDialogFragment extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
Message msg = new Message();
msg.what=MESSAGE_MIDDLE_CLICKED;
msg.what = MESSAGE_MIDDLE_CLICKED;
try {
messenger.send(msg);
} catch (RemoteException e) {