mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
043ed600e6
@ -139,7 +139,7 @@ public class Preferences {
|
|||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getFirstTime() {
|
public boolean isFirstTime() {
|
||||||
return mSharedPreferences.getBoolean(Constants.Pref.FIRST_TIME, true);
|
return mSharedPreferences.getBoolean(Constants.Pref.FIRST_TIME, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ import java.util.regex.Matcher;
|
|||||||
|
|
||||||
public class CreateKeyActivity extends ActionBarActivity {
|
public class CreateKeyActivity extends ActionBarActivity {
|
||||||
|
|
||||||
AutoCompleteTextView nameEdit;
|
AutoCompleteTextView mNameEdit;
|
||||||
AutoCompleteTextView emailEdit;
|
AutoCompleteTextView mEmailEdit;
|
||||||
EditText passphraseEdit;
|
EditText mPassphraseEdit;
|
||||||
Button createButton;
|
Button mCreateButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -56,19 +56,19 @@ public class CreateKeyActivity extends ActionBarActivity {
|
|||||||
|
|
||||||
setContentView(R.layout.create_key_activity);
|
setContentView(R.layout.create_key_activity);
|
||||||
|
|
||||||
nameEdit = (AutoCompleteTextView) findViewById(R.id.name);
|
mNameEdit = (AutoCompleteTextView) findViewById(R.id.name);
|
||||||
emailEdit = (AutoCompleteTextView) findViewById(R.id.email);
|
mEmailEdit = (AutoCompleteTextView) findViewById(R.id.email);
|
||||||
passphraseEdit = (EditText) findViewById(R.id.passphrase);
|
mPassphraseEdit = (EditText) findViewById(R.id.passphrase);
|
||||||
createButton = (Button) findViewById(R.id.create_key_button);
|
mCreateButton = (Button) findViewById(R.id.create_key_button);
|
||||||
|
|
||||||
emailEdit.setThreshold(1); // Start working from first character
|
mEmailEdit.setThreshold(1); // Start working from first character
|
||||||
emailEdit.setAdapter(
|
mEmailEdit.setAdapter(
|
||||||
new ArrayAdapter<String>
|
new ArrayAdapter<String>
|
||||||
(this, android.R.layout.simple_spinner_dropdown_item,
|
(this, android.R.layout.simple_spinner_dropdown_item,
|
||||||
ContactHelper.getPossibleUserEmails(this)
|
ContactHelper.getPossibleUserEmails(this)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
emailEdit.addTextChangedListener(new TextWatcher() {
|
mEmailEdit.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||||
}
|
}
|
||||||
@ -83,27 +83,28 @@ public class CreateKeyActivity extends ActionBarActivity {
|
|||||||
if (email.length() > 0) {
|
if (email.length() > 0) {
|
||||||
Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email);
|
Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email);
|
||||||
if (emailMatcher.matches()) {
|
if (emailMatcher.matches()) {
|
||||||
emailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
mEmailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
||||||
R.drawable.uid_mail_ok, 0);
|
R.drawable.uid_mail_ok, 0);
|
||||||
} else {
|
} else {
|
||||||
emailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
mEmailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0,
|
||||||
R.drawable.uid_mail_bad, 0);
|
R.drawable.uid_mail_bad, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// remove drawable if email is empty
|
// remove drawable if email is empty
|
||||||
emailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
mEmailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nameEdit.setThreshold(1); // Start working from first character
|
|
||||||
nameEdit.setAdapter(
|
mNameEdit.setThreshold(1); // Start working from first character
|
||||||
|
mNameEdit.setAdapter(
|
||||||
new ArrayAdapter<String>
|
new ArrayAdapter<String>
|
||||||
(this, android.R.layout.simple_spinner_dropdown_item,
|
(this, android.R.layout.simple_spinner_dropdown_item,
|
||||||
ContactHelper.getPossibleUserNames(this)
|
ContactHelper.getPossibleUserNames(this)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
createButton.setOnClickListener(new View.OnClickListener() {
|
mCreateButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
createKeyCheck();
|
createKeyCheck();
|
||||||
@ -113,9 +114,9 @@ public class CreateKeyActivity extends ActionBarActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createKeyCheck() {
|
private void createKeyCheck() {
|
||||||
if (isEditTextNotEmpty(this, nameEdit)
|
if (isEditTextNotEmpty(this, mNameEdit)
|
||||||
&& isEditTextNotEmpty(this, emailEdit)
|
&& isEditTextNotEmpty(this, mEmailEdit)
|
||||||
&& isEditTextNotEmpty(this, passphraseEdit)) {
|
&& isEditTextNotEmpty(this, mPassphraseEdit)) {
|
||||||
createKey();
|
createKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,6 +135,7 @@ public class CreateKeyActivity extends ActionBarActivity {
|
|||||||
super.handleMessage(message);
|
super.handleMessage(message);
|
||||||
|
|
||||||
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
|
||||||
|
CreateKeyActivity.this.setResult(RESULT_OK);
|
||||||
CreateKeyActivity.this.finish();
|
CreateKeyActivity.this.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,9 +148,9 @@ public class CreateKeyActivity extends ActionBarActivity {
|
|||||||
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.CERTIFY_OTHER, null));
|
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.CERTIFY_OTHER, null));
|
||||||
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.SIGN_DATA, null));
|
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.SIGN_DATA, null));
|
||||||
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, null));
|
parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd(Constants.choice.algorithm.rsa, 4096, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, null));
|
||||||
String userId = nameEdit.getText().toString() + " <" + emailEdit.getText().toString() + ">";
|
String userId = mNameEdit.getText().toString() + " <" + mEmailEdit.getText().toString() + ">";
|
||||||
parcel.mAddUserIds.add(userId);
|
parcel.mAddUserIds.add(userId);
|
||||||
parcel.mNewPassphrase = passphraseEdit.getText().toString();
|
parcel.mNewPassphrase = mPassphraseEdit.getText().toString();
|
||||||
|
|
||||||
// get selected key entries
|
// get selected key entries
|
||||||
data.putParcelable(KeychainIntentService.SAVE_KEYRING_PARCEL, parcel);
|
data.putParcelable(KeychainIntentService.SAVE_KEYRING_PARCEL, parcel);
|
||||||
|
@ -25,6 +25,7 @@ import android.view.Window;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||||
|
|
||||||
public class FirstTimeActivity extends ActionBarActivity {
|
public class FirstTimeActivity extends ActionBarActivity {
|
||||||
|
|
||||||
@ -47,9 +48,7 @@ public class FirstTimeActivity extends ActionBarActivity {
|
|||||||
mSkipSetup.setOnClickListener(new View.OnClickListener() {
|
mSkipSetup.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(FirstTimeActivity.this, KeyListActivity.class);
|
finishSetup();
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,8 +57,7 @@ public class FirstTimeActivity extends ActionBarActivity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(FirstTimeActivity.this, ImportKeysActivity.class);
|
Intent intent = new Intent(FirstTimeActivity.this, ImportKeysActivity.class);
|
||||||
intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN);
|
intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_FILE_AND_RETURN);
|
||||||
startActivity(intent);
|
startActivityForResult(intent, 1);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,11 +65,26 @@ public class FirstTimeActivity extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(FirstTimeActivity.this, CreateKeyActivity.class);
|
Intent intent = new Intent(FirstTimeActivity.this, CreateKeyActivity.class);
|
||||||
startActivity(intent);
|
startActivityForResult(intent, 1);
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
finishSetup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishSetup() {
|
||||||
|
Preferences prefs = Preferences.getPreferences(this);
|
||||||
|
prefs.setFirstTime(false);
|
||||||
|
Intent intent = new Intent(FirstTimeActivity.this, KeyListActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,28 +17,19 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
import android.app.ProgressDialog;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
|
||||||
import android.os.Messenger;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import com.devspark.appmsg.AppMsg;
|
import com.devspark.appmsg.AppMsg;
|
||||||
|
|
||||||
import org.spongycastle.bcpg.sig.KeyFlags;
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.Constants.choice.algorithm;
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
||||||
import org.sufficientlysecure.keychain.helper.Preferences;
|
import org.sufficientlysecure.keychain.helper.Preferences;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
|
|
||||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
|
||||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.SubkeyAdd;
|
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -51,11 +42,10 @@ public class KeyListActivity extends DrawerActivity {
|
|||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// if this is the first time show first time activity
|
||||||
Preferences prefs = Preferences.getPreferences(this);
|
Preferences prefs = Preferences.getPreferences(this);
|
||||||
if (prefs.getFirstTime()) {
|
if (prefs.isFirstTime()) {
|
||||||
prefs.setFirstTime(false);
|
startActivity(new Intent(this, FirstTimeActivity.class));
|
||||||
Intent intent = new Intent(this, FirstTimeActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
2
extern/openpgp-api-lib
vendored
2
extern/openpgp-api-lib
vendored
@ -1 +1 @@
|
|||||||
Subproject commit cd1a6748dd7a4c7a251a4f75eb289955dfbb1058
|
Subproject commit 869ab96e6dcd4821fd5360248429e49dae6fbaca
|
Loading…
Reference in New Issue
Block a user