mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-16 13:55:03 -05:00
Adjust variable/member naming to conform to style guide
In some cases change member accessibility, so the naming matches. Also, some key words were reordered to comply with JLS suggestions.
This commit is contained in:
parent
dd4a1e3f52
commit
d5983b324f
@ -30,7 +30,7 @@ import java.util.Vector;
|
|||||||
* Singleton Implementation of a Preference Helper
|
* Singleton Implementation of a Preference Helper
|
||||||
*/
|
*/
|
||||||
public class Preferences {
|
public class Preferences {
|
||||||
private static Preferences mPreferences;
|
private static Preferences sPreferences;
|
||||||
private SharedPreferences mSharedPreferences;
|
private SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
public static synchronized Preferences getPreferences(Context context) {
|
public static synchronized Preferences getPreferences(Context context) {
|
||||||
@ -38,10 +38,10 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized Preferences getPreferences(Context context, boolean forceNew) {
|
public static synchronized Preferences getPreferences(Context context, boolean forceNew) {
|
||||||
if (mPreferences == null || forceNew) {
|
if (sPreferences == null || forceNew) {
|
||||||
mPreferences = new Preferences(context);
|
sPreferences = new Preferences(context);
|
||||||
}
|
}
|
||||||
return mPreferences;
|
return sPreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Preferences(Context context) {
|
private Preferences(Context context) {
|
||||||
|
@ -22,14 +22,14 @@ import android.content.Context;
|
|||||||
public class PgpGeneralMsgIdException extends Exception {
|
public class PgpGeneralMsgIdException extends Exception {
|
||||||
static final long serialVersionUID = 0xf812773343L;
|
static final long serialVersionUID = 0xf812773343L;
|
||||||
|
|
||||||
private final int msgId;
|
private final int mMessageId;
|
||||||
|
|
||||||
public PgpGeneralMsgIdException(int msgId) {
|
public PgpGeneralMsgIdException(int messageId) {
|
||||||
super("msg[" + msgId + "]");
|
super("msg[" + messageId + "]");
|
||||||
this.msgId = msgId;
|
mMessageId = messageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PgpGeneralException getContextualized(Context context) {
|
public PgpGeneralException getContextualized(Context context) {
|
||||||
return new PgpGeneralException(context.getString(msgId), this);
|
return new PgpGeneralException(context.getString(mMessageId), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,8 +264,8 @@ public class EncryptAsymmetricFragment extends Fragment {
|
|||||||
|
|
||||||
case RESULT_CODE_SECRET_KEYS: {
|
case RESULT_CODE_SECRET_KEYS: {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
Uri uri_master_key = data.getData();
|
Uri uriMasterKey = data.getData();
|
||||||
setSignatureKeyId(Long.valueOf(uri_master_key.getLastPathSegment()));
|
setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
|
||||||
} else {
|
} else {
|
||||||
setSignatureKeyId(Id.key.none);
|
setSignatureKeyId(Id.key.none);
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,11 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV";
|
public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV";
|
||||||
|
|
||||||
private PreferenceScreen mKeyServerPreference = null;
|
private PreferenceScreen mKeyServerPreference = null;
|
||||||
private static Preferences mPreferences;
|
private static Preferences sPreferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
mPreferences = Preferences.getPreferences(this);
|
sPreferences = Preferences.getPreferences(this);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// final ActionBar actionBar = getSupportActionBar();
|
// final ActionBar actionBar = getSupportActionBar();
|
||||||
@ -59,7 +59,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
||||||
|
|
||||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
||||||
String servers[] = mPreferences.getKeyServers();
|
String servers[] = sPreferences.getKeyServers();
|
||||||
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
||||||
servers.length, servers.length));
|
servers.length, servers.length));
|
||||||
mKeyServerPreference
|
mKeyServerPreference
|
||||||
@ -68,7 +68,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
Intent intent = new Intent(PreferencesActivity.this,
|
Intent intent = new Intent(PreferencesActivity.this,
|
||||||
PreferencesKeyServerActivity.class);
|
PreferencesKeyServerActivity.class);
|
||||||
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
||||||
mPreferences.getKeyServers());
|
sPreferences.getKeyServers());
|
||||||
startActivityForResult(intent, Id.request.key_server_preference);
|
startActivityForResult(intent, Id.request.key_server_preference);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
String servers[] = data
|
String servers[] = data
|
||||||
.getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS);
|
.getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS);
|
||||||
mPreferences.setKeyServers(servers);
|
sPreferences.setKeyServers(servers);
|
||||||
mKeyServerPreference.setSummary(getResources().getQuantityString(
|
mKeyServerPreference.setSummary(getResources().getQuantityString(
|
||||||
R.plurals.n_key_servers, servers.length, servers.length));
|
R.plurals.n_key_servers, servers.length, servers.length));
|
||||||
break;
|
break;
|
||||||
@ -163,7 +163,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
(IntegerListPreference) findPreference(Constants.Pref.PASS_PHRASE_CACHE_TTL));
|
||||||
|
|
||||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.Pref.KEY_SERVERS);
|
||||||
String servers[] = mPreferences.getKeyServers();
|
String servers[] = sPreferences.getKeyServers();
|
||||||
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers,
|
||||||
servers.length, servers.length));
|
servers.length, servers.length));
|
||||||
mKeyServerPreference
|
mKeyServerPreference
|
||||||
@ -172,7 +172,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
Intent intent = new Intent(getActivity(),
|
Intent intent = new Intent(getActivity(),
|
||||||
PreferencesKeyServerActivity.class);
|
PreferencesKeyServerActivity.class);
|
||||||
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
||||||
mPreferences.getKeyServers());
|
sPreferences.getKeyServers());
|
||||||
startActivityForResult(intent, Id.request.key_server_preference);
|
startActivityForResult(intent, Id.request.key_server_preference);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
String servers[] = data
|
String servers[] = data
|
||||||
.getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS);
|
.getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS);
|
||||||
mPreferences.setKeyServers(servers);
|
sPreferences.setKeyServers(servers);
|
||||||
mKeyServerPreference.setSummary(getResources().getQuantityString(
|
mKeyServerPreference.setSummary(getResources().getQuantityString(
|
||||||
R.plurals.n_key_servers, servers.length, servers.length));
|
R.plurals.n_key_servers, servers.length, servers.length));
|
||||||
break;
|
break;
|
||||||
@ -256,14 +256,14 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) {
|
private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) {
|
||||||
mPassphraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl());
|
mPassphraseCacheTtl.setValue("" + sPreferences.getPassPhraseCacheTtl());
|
||||||
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
||||||
mPassphraseCacheTtl
|
mPassphraseCacheTtl
|
||||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mPassphraseCacheTtl.setValue(newValue.toString());
|
mPassphraseCacheTtl.setValue(newValue.toString());
|
||||||
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry());
|
||||||
mPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString()));
|
sPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -282,14 +282,14 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
mEncryptionAlgorithm.setEntries(entries);
|
mEncryptionAlgorithm.setEntries(entries);
|
||||||
mEncryptionAlgorithm.setEntryValues(values);
|
mEncryptionAlgorithm.setEntryValues(values);
|
||||||
mEncryptionAlgorithm.setValue("" + mPreferences.getDefaultEncryptionAlgorithm());
|
mEncryptionAlgorithm.setValue("" + sPreferences.getDefaultEncryptionAlgorithm());
|
||||||
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
||||||
mEncryptionAlgorithm
|
mEncryptionAlgorithm
|
||||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mEncryptionAlgorithm.setValue(newValue.toString());
|
mEncryptionAlgorithm.setValue(newValue.toString());
|
||||||
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
||||||
mPreferences.setDefaultEncryptionAlgorithm(Integer.parseInt(newValue
|
sPreferences.setDefaultEncryptionAlgorithm(Integer.parseInt(newValue
|
||||||
.toString()));
|
.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -309,13 +309,13 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
mHashAlgorithm.setEntries(entries);
|
mHashAlgorithm.setEntries(entries);
|
||||||
mHashAlgorithm.setEntryValues(values);
|
mHashAlgorithm.setEntryValues(values);
|
||||||
mHashAlgorithm.setValue("" + mPreferences.getDefaultHashAlgorithm());
|
mHashAlgorithm.setValue("" + sPreferences.getDefaultHashAlgorithm());
|
||||||
mHashAlgorithm.setSummary(mHashAlgorithm.getEntry());
|
mHashAlgorithm.setSummary(mHashAlgorithm.getEntry());
|
||||||
mHashAlgorithm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mHashAlgorithm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mHashAlgorithm.setValue(newValue.toString());
|
mHashAlgorithm.setValue(newValue.toString());
|
||||||
mHashAlgorithm.setSummary(mHashAlgorithm.getEntry());
|
mHashAlgorithm.setSummary(mHashAlgorithm.getEntry());
|
||||||
mPreferences.setDefaultHashAlgorithm(Integer.parseInt(newValue.toString()));
|
sPreferences.setDefaultHashAlgorithm(Integer.parseInt(newValue.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -326,14 +326,14 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
int[] valueIds, String[] entries, String[] values) {
|
int[] valueIds, String[] entries, String[] values) {
|
||||||
mMessageCompression.setEntries(entries);
|
mMessageCompression.setEntries(entries);
|
||||||
mMessageCompression.setEntryValues(values);
|
mMessageCompression.setEntryValues(values);
|
||||||
mMessageCompression.setValue("" + mPreferences.getDefaultMessageCompression());
|
mMessageCompression.setValue("" + sPreferences.getDefaultMessageCompression());
|
||||||
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
||||||
mMessageCompression
|
mMessageCompression
|
||||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mMessageCompression.setValue(newValue.toString());
|
mMessageCompression.setValue(newValue.toString());
|
||||||
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
||||||
mPreferences.setDefaultMessageCompression(Integer.parseInt(newValue
|
sPreferences.setDefaultMessageCompression(Integer.parseInt(newValue
|
||||||
.toString()));
|
.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -344,36 +344,36 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(final IntegerListPreference mFileCompression, String[] entries, String[] values) {
|
(final IntegerListPreference mFileCompression, String[] entries, String[] values) {
|
||||||
mFileCompression.setEntries(entries);
|
mFileCompression.setEntries(entries);
|
||||||
mFileCompression.setEntryValues(values);
|
mFileCompression.setEntryValues(values);
|
||||||
mFileCompression.setValue("" + mPreferences.getDefaultFileCompression());
|
mFileCompression.setValue("" + sPreferences.getDefaultFileCompression());
|
||||||
mFileCompression.setSummary(mFileCompression.getEntry());
|
mFileCompression.setSummary(mFileCompression.getEntry());
|
||||||
mFileCompression.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mFileCompression.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mFileCompression.setValue(newValue.toString());
|
mFileCompression.setValue(newValue.toString());
|
||||||
mFileCompression.setSummary(mFileCompression.getEntry());
|
mFileCompression.setSummary(mFileCompression.getEntry());
|
||||||
mPreferences.setDefaultFileCompression(Integer.parseInt(newValue.toString()));
|
sPreferences.setDefaultFileCompression(Integer.parseInt(newValue.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) {
|
private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) {
|
||||||
mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour());
|
mAsciiArmour.setChecked(sPreferences.getDefaultAsciiArmour());
|
||||||
mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mAsciiArmour.setChecked((Boolean) newValue);
|
mAsciiArmour.setChecked((Boolean) newValue);
|
||||||
mPreferences.setDefaultAsciiArmour((Boolean) newValue);
|
sPreferences.setDefaultAsciiArmour((Boolean) newValue);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initializeForceV3Signatures(final CheckBoxPreference mForceV3Signatures) {
|
private static void initializeForceV3Signatures(final CheckBoxPreference mForceV3Signatures) {
|
||||||
mForceV3Signatures.setChecked(mPreferences.getForceV3Signatures());
|
mForceV3Signatures.setChecked(sPreferences.getForceV3Signatures());
|
||||||
mForceV3Signatures
|
mForceV3Signatures
|
||||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
mForceV3Signatures.setChecked((Boolean) newValue);
|
mForceV3Signatures.setChecked((Boolean) newValue);
|
||||||
mPreferences.setForceV3Signatures((Boolean) newValue);
|
sPreferences.setForceV3Signatures((Boolean) newValue);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -44,12 +44,12 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
|||||||
protected List<ImportKeysListEntry> mData;
|
protected List<ImportKeysListEntry> mData;
|
||||||
|
|
||||||
static class ViewHolder {
|
static class ViewHolder {
|
||||||
private TextView mainUserId;
|
public TextView mainUserId;
|
||||||
private TextView mainUserIdRest;
|
public TextView mainUserIdRest;
|
||||||
private TextView keyId;
|
public TextView keyId;
|
||||||
private TextView fingerprint;
|
public TextView fingerprint;
|
||||||
private TextView algorithm;
|
public TextView algorithm;
|
||||||
private TextView status;
|
public TextView status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImportKeysAdapter(Activity activity) {
|
public ImportKeysAdapter(Activity activity) {
|
||||||
|
@ -249,7 +249,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Based on <a href="http://tools.ietf.org/html/rfc2440#section-9.1">OpenPGP Message Format</a>
|
* Based on <a href="http://tools.ietf.org/html/rfc2440#section-9.1">OpenPGP Message Format</a>
|
||||||
*/
|
*/
|
||||||
private final static SparseArray<String> ALGORITHM_IDS = new SparseArray<String>() {{
|
private static final SparseArray<String> ALGORITHM_IDS = new SparseArray<String>() {{
|
||||||
put(-1, "unknown"); // TODO: with resources
|
put(-1, "unknown"); // TODO: with resources
|
||||||
put(0, "unencrypted");
|
put(0, "unencrypted");
|
||||||
put(PGPPublicKey.RSA_GENERAL, "RSA");
|
put(PGPPublicKey.RSA_GENERAL, "RSA");
|
||||||
|
@ -30,9 +30,9 @@ public class PagerTabStripAdapter extends FragmentPagerAdapter {
|
|||||||
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
|
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
|
||||||
|
|
||||||
static final class TabInfo {
|
static final class TabInfo {
|
||||||
private final Class<?> clss;
|
public final Class<?> clss;
|
||||||
private final Bundle args;
|
public final Bundle args;
|
||||||
private final String title;
|
public final String title;
|
||||||
|
|
||||||
TabInfo(Class<?> clss, Bundle args, String title) {
|
TabInfo(Class<?> clss, Bundle args, String title) {
|
||||||
this.clss = clss;
|
this.clss = clss;
|
||||||
|
@ -36,8 +36,8 @@ public class TabsAdapter extends FragmentStatePagerAdapter implements ActionBar.
|
|||||||
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
|
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
|
||||||
|
|
||||||
static final class TabInfo {
|
static final class TabInfo {
|
||||||
private final Class<?> clss;
|
public final Class<?> clss;
|
||||||
private final Bundle args;
|
public final Bundle args;
|
||||||
|
|
||||||
TabInfo(Class<?> clss, Bundle args) {
|
TabInfo(Class<?> clss, Bundle args) {
|
||||||
this.clss = clss;
|
this.clss = clss;
|
||||||
|
@ -37,7 +37,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
private int mIndexUserId, mIndexRank;
|
private int mIndexUserId, mIndexRank;
|
||||||
|
|
||||||
final private ArrayList<Boolean> mCheckStates;
|
private final ArrayList<Boolean> mCheckStates;
|
||||||
|
|
||||||
public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags, boolean showCheckBoxes) {
|
public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags, boolean showCheckBoxes) {
|
||||||
super(context, c, flags);
|
super(context, c, flags);
|
||||||
|
@ -51,12 +51,12 @@ public class DeleteKeyDialogFragment extends DialogFragment {
|
|||||||
public static final int MESSAGE_OKAY = 1;
|
public static final int MESSAGE_OKAY = 1;
|
||||||
public static final int MESSAGE_ERROR = 0;
|
public static final int MESSAGE_ERROR = 0;
|
||||||
|
|
||||||
private boolean isSingleSelection = false;
|
private boolean mIsSingleSelection = false;
|
||||||
|
|
||||||
private TextView mainMessage;
|
private TextView mMainMessage;
|
||||||
private CheckBox checkDeleteSecret;
|
private CheckBox mCheckDeleteSecret;
|
||||||
private LinearLayout deleteSecretKeyView;
|
private LinearLayout mDeleteSecretKeyView;
|
||||||
private View inflateView;
|
private View mInflateView;
|
||||||
|
|
||||||
private Messenger mMessenger;
|
private Messenger mMessenger;
|
||||||
|
|
||||||
@ -90,12 +90,12 @@ public class DeleteKeyDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
//Setup custom View to display in AlertDialog
|
//Setup custom View to display in AlertDialog
|
||||||
LayoutInflater inflater = activity.getLayoutInflater();
|
LayoutInflater inflater = activity.getLayoutInflater();
|
||||||
inflateView = inflater.inflate(R.layout.view_key_delete_fragment, null);
|
mInflateView = inflater.inflate(R.layout.view_key_delete_fragment, null);
|
||||||
builder.setView(inflateView);
|
builder.setView(mInflateView);
|
||||||
|
|
||||||
deleteSecretKeyView = (LinearLayout) inflateView.findViewById(R.id.deleteSecretKeyView);
|
mDeleteSecretKeyView = (LinearLayout) mInflateView.findViewById(R.id.deleteSecretKeyView);
|
||||||
mainMessage = (TextView) inflateView.findViewById(R.id.mainMessage);
|
mMainMessage = (TextView) mInflateView.findViewById(R.id.mainMessage);
|
||||||
checkDeleteSecret = (CheckBox) inflateView.findViewById(R.id.checkDeleteSecret);
|
mCheckDeleteSecret = (CheckBox) mInflateView.findViewById(R.id.checkDeleteSecret);
|
||||||
|
|
||||||
builder.setTitle(R.string.warning);
|
builder.setTitle(R.string.warning);
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ public class DeleteKeyDialogFragment extends DialogFragment {
|
|||||||
if (keyRingRowIds.length == 1) {
|
if (keyRingRowIds.length == 1) {
|
||||||
Uri dataUri;
|
Uri dataUri;
|
||||||
ArrayList<Long> publicKeyRings; //Any one will do
|
ArrayList<Long> publicKeyRings; //Any one will do
|
||||||
isSingleSelection = true;
|
mIsSingleSelection = true;
|
||||||
|
|
||||||
long selectedRow = keyRingRowIds[0];
|
long selectedRow = keyRingRowIds[0];
|
||||||
long keyType;
|
long keyType;
|
||||||
@ -119,16 +119,16 @@ public class DeleteKeyDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String userId = ProviderHelper.getUserId(activity, dataUri);
|
String userId = ProviderHelper.getUserId(activity, dataUri);
|
||||||
//Hide the Checkbox and TextView since this is a single selection,user will be notified thru message
|
// Hide the Checkbox and TextView since this is a single selection,
|
||||||
deleteSecretKeyView.setVisibility(View.GONE);
|
// user will be notified thru message
|
||||||
//Set message depending on which key it is.
|
mDeleteSecretKeyView.setVisibility(View.GONE);
|
||||||
mainMessage.setText(getString(keyType == Id.type.secret_key ? R.string.secret_key_deletion_confirmation
|
// Set message depending on which key it is.
|
||||||
: R.string.public_key_deletetion_confirmation, userId));
|
mMainMessage.setText(getString(keyType == Id.type.secret_key ?
|
||||||
|
R.string.secret_key_deletion_confirmation :
|
||||||
|
R.string.public_key_deletetion_confirmation, userId));
|
||||||
} else {
|
} else {
|
||||||
deleteSecretKeyView.setVisibility(View.VISIBLE);
|
mDeleteSecretKeyView.setVisibility(View.VISIBLE);
|
||||||
mainMessage.setText(R.string.key_deletion_confirmation_multi);
|
mMainMessage.setText(R.string.key_deletion_confirmation_multi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,8 +171,9 @@ public class DeleteKeyDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
|
|
||||||
if (keyType == KeychainContract.KeyTypes.SECRET) {
|
if (keyType == KeychainContract.KeyTypes.SECRET) {
|
||||||
if (checkDeleteSecret.isChecked() || isSingleSelection) {
|
if (mCheckDeleteSecret.isChecked() || mIsSingleSelection) {
|
||||||
ProviderHelper.deleteUnifiedKeyRing(activity, String.valueOf(masterKeyId), true);
|
ProviderHelper.deleteUnifiedKeyRing(activity,
|
||||||
|
String.valueOf(masterKeyId), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ProviderHelper.deleteUnifiedKeyRing(activity, String.valueOf(masterKeyId), false);
|
ProviderHelper.deleteUnifiedKeyRing(activity, String.valueOf(masterKeyId), false);
|
||||||
@ -180,8 +181,10 @@ public class DeleteKeyDialogFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check if the selected rows have actually been deleted
|
//Check if the selected rows have actually been deleted
|
||||||
cursor = activity.getContentResolver().query(queryUri, projection, selection, null, null);
|
cursor = activity.getContentResolver().query(
|
||||||
if (cursor == null || cursor.getCount() == 0 || !checkDeleteSecret.isChecked()) {
|
queryUri, projection, selection, null, null);
|
||||||
|
if (cursor == null || cursor.getCount() == 0 ||
|
||||||
|
!mCheckDeleteSecret.isChecked()) {
|
||||||
isSuccessfullyDeleted = true;
|
isSuccessfullyDeleted = true;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -61,7 +61,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
|
|
||||||
private Choice mNewKeyAlgorithmChoice;
|
private Choice mNewKeyAlgorithmChoice;
|
||||||
private int mNewKeySize;
|
private int mNewKeySize;
|
||||||
private boolean oldItemDeleted = false;
|
private boolean mOldItemDeleted = false;
|
||||||
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
|
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
|
||||||
private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
|
private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
|
||||||
private boolean mCanEdit = true;
|
private boolean mCanEdit = true;
|
||||||
@ -138,13 +138,13 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void onDeleted(Editor editor, boolean wasNewItem) {
|
public void onDeleted(Editor editor, boolean wasNewItem) {
|
||||||
oldItemDeleted |= !wasNewItem;
|
mOldItemDeleted |= !wasNewItem;
|
||||||
if (oldItemDeleted) {
|
if (mOldItemDeleted) {
|
||||||
if (mType == Id.type.user_id)
|
if (mType == Id.type.user_id) {
|
||||||
mDeletedIDs.add(((UserIdEditor)editor).getOriginalID());
|
mDeletedIDs.add(((UserIdEditor) editor).getOriginalID());
|
||||||
else if (mType == Id.type.key)
|
} else if (mType == Id.type.key) {
|
||||||
mDeletedKeys.add(((KeyEditor)editor).getValue());
|
mDeletedKeys.add(((KeyEditor) editor).getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.updateEditorsVisible();
|
this.updateEditorsVisible();
|
||||||
if (mEditorListener != null) {
|
if (mEditorListener != null) {
|
||||||
@ -167,7 +167,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
public boolean needsSaving()
|
public boolean needsSaving()
|
||||||
{
|
{
|
||||||
//check each view for needs saving, take account of deleted items
|
//check each view for needs saving, take account of deleted items
|
||||||
boolean ret = oldItemDeleted;
|
boolean ret = mOldItemDeleted;
|
||||||
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
||||||
Editor editor = (Editor) mEditors.getChildAt(i);
|
Editor editor = (Editor) mEditors.getChildAt(i);
|
||||||
ret |= editor.needsSaving();
|
ret |= editor.needsSaving();
|
||||||
|
Loading…
Reference in New Issue
Block a user