mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 22:29:53 +01:00
cleaning up
This commit is contained in:
@@ -15,6 +15,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.TextView.OnEditorActionListener;
|
import android.widget.TextView.OnEditorActionListener;
|
||||||
|
|
||||||
import org.briarproject.R;
|
import org.briarproject.R;
|
||||||
|
import org.briarproject.android.event.LocalAuthorCreatedEvent;
|
||||||
import org.briarproject.android.helper.SetupHelper;
|
import org.briarproject.android.helper.SetupHelper;
|
||||||
import org.briarproject.android.util.AndroidUtils;
|
import org.briarproject.android.util.AndroidUtils;
|
||||||
import org.briarproject.android.util.StrengthMeter;
|
import org.briarproject.android.util.StrengthMeter;
|
||||||
@@ -25,6 +26,7 @@ import org.briarproject.api.crypto.KeyPair;
|
|||||||
import org.briarproject.api.crypto.PasswordStrengthEstimator;
|
import org.briarproject.api.crypto.PasswordStrengthEstimator;
|
||||||
import org.briarproject.api.crypto.SecretKey;
|
import org.briarproject.api.crypto.SecretKey;
|
||||||
import org.briarproject.api.db.DatabaseConfig;
|
import org.briarproject.api.db.DatabaseConfig;
|
||||||
|
import org.briarproject.api.event.Event;
|
||||||
import org.briarproject.api.identity.AuthorFactory;
|
import org.briarproject.api.identity.AuthorFactory;
|
||||||
import org.briarproject.api.identity.LocalAuthor;
|
import org.briarproject.api.identity.LocalAuthor;
|
||||||
import org.briarproject.util.StringUtils;
|
import org.briarproject.util.StringUtils;
|
||||||
@@ -64,15 +66,18 @@ public class SetupActivity extends BaseActivity implements OnClickListener,
|
|||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
setContentView(R.layout.activity_setup);
|
setContentView(R.layout.activity_setup);
|
||||||
|
|
||||||
nicknameEntryWrapper = (TextInputLayout)findViewById(R.id.nickname_entry_wrapper);
|
nicknameEntryWrapper =
|
||||||
passwordEntryWrapper = (TextInputLayout)findViewById(R.id.password_entry_wrapper);
|
(TextInputLayout) findViewById(R.id.nickname_entry_wrapper);
|
||||||
passwordConfirmationWrapper = (TextInputLayout)findViewById(R.id.password_confirm_wrapper);
|
passwordEntryWrapper =
|
||||||
nicknameEntry = (EditText)findViewById(R.id.nickname_entry);
|
(TextInputLayout) findViewById(R.id.password_entry_wrapper);
|
||||||
passwordEntry = (EditText)findViewById(R.id.password_entry);
|
passwordConfirmationWrapper =
|
||||||
passwordConfirmation = (EditText)findViewById(R.id.password_confirm);
|
(TextInputLayout) findViewById(R.id.password_confirm_wrapper);
|
||||||
strengthMeter = (StrengthMeter)findViewById(R.id.strength_meter);
|
nicknameEntry = (EditText) findViewById(R.id.nickname_entry);
|
||||||
createAccountButton = (Button)findViewById(R.id.create_account);
|
passwordEntry = (EditText) findViewById(R.id.password_entry);
|
||||||
progress = (ProgressBar)findViewById(R.id.progress_wheel);
|
passwordConfirmation = (EditText) findViewById(R.id.password_confirm);
|
||||||
|
strengthMeter = (StrengthMeter) findViewById(R.id.strength_meter);
|
||||||
|
createAccountButton = (Button) findViewById(R.id.create_account);
|
||||||
|
progress = (ProgressBar) findViewById(R.id.progress_wheel);
|
||||||
|
|
||||||
if (PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
if (PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
|
||||||
|
|
||||||
@@ -144,32 +149,24 @@ public class SetupActivity extends BaseActivity implements OnClickListener,
|
|||||||
final String nickname = nicknameEntry.getText().toString();
|
final String nickname = nicknameEntry.getText().toString();
|
||||||
final String password = passwordEntry.getText().toString();
|
final String password = passwordEntry.getText().toString();
|
||||||
setupHelper.createIdentity(nickname, password);
|
setupHelper.createIdentity(nickname, password);
|
||||||
// // Store the DB key and create the identity in a background thread
|
|
||||||
// cryptoExecutor.execute(new Runnable() {
|
|
||||||
// public void run() {
|
|
||||||
// SecretKey key = crypto.generateSecretKey();
|
|
||||||
// databaseConfig.setEncryptionKey(key);
|
|
||||||
// String hex = encryptDatabaseKey(key, password);
|
|
||||||
// storeEncryptedDatabaseKey(hex);
|
|
||||||
// LocalAuthor localAuthor = createLocalAuthor(nickname);
|
|
||||||
// showDashboard(referenceManager.putReference(localAuthor,
|
|
||||||
// LocalAuthor.class));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void eventOccurred(Event e) {
|
||||||
|
super.eventOccurred(e);
|
||||||
|
if (e instanceof LocalAuthorCreatedEvent) {
|
||||||
|
long handle = ((LocalAuthorCreatedEvent)e).getAuthorHandle();
|
||||||
|
showDashboard(handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showDashboard(final long handle) {
|
private void showDashboard(final long handle) {
|
||||||
runOnUiThread(new Runnable() {
|
Intent i = new Intent(SetupActivity.this,
|
||||||
public void run() {
|
NavDrawerActivity.class);
|
||||||
Intent i = new Intent(SetupActivity.this,
|
i.putExtra(BriarActivity.KEY_LOCAL_AUTHOR_HANDLE, handle);
|
||||||
NavDrawerActivity.class);
|
i.setFlags(FLAG_ACTIVITY_NEW_TASK);
|
||||||
i.putExtra(BriarActivity.KEY_LOCAL_AUTHOR_HANDLE, handle);
|
startActivity(i);
|
||||||
i.setFlags(FLAG_ACTIVITY_NEW_TASK);
|
finish();
|
||||||
startActivity(i);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// AndroidComponent component =
|
|
||||||
// ((BriarApplication) getActivity().getApplication())
|
|
||||||
// .getApplicationComponent();
|
|
||||||
// injectActivity(component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface BaseFragmentListener {
|
public interface BaseFragmentListener {
|
||||||
|
|||||||
@@ -42,12 +42,10 @@ public class PasswordHelperImp extends ConfigHelperImp
|
|||||||
public void run() {
|
public void run() {
|
||||||
byte[] key = crypto.decryptWithPassword(encrypted, password);
|
byte[] key = crypto.decryptWithPassword(encrypted, password);
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
// tryAgain();.
|
|
||||||
onPasswordValidated(false);
|
onPasswordValidated(false);
|
||||||
} else {
|
} else {
|
||||||
databaseConfig.setEncryptionKey(new SecretKey(key));
|
databaseConfig.setEncryptionKey(new SecretKey(key));
|
||||||
onPasswordValidated(true);
|
onPasswordValidated(true);
|
||||||
// setResultAndFinish();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user