fix register account checkbox glitch
This commit is contained in:
parent
10240ab2f9
commit
ca625f1e8e
|
@ -776,7 +776,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
SQLiteDatabase db = this.getReadableDatabase();
|
||||||
final List<Jid> jids = new ArrayList<>();
|
final List<Jid> jids = new ArrayList<>();
|
||||||
final String[] columns = new String[]{Account.USERNAME, Account.SERVER};
|
final String[] columns = new String[]{Account.USERNAME, Account.SERVER};
|
||||||
Cursor cursor = db.query(Account.TABLENAME,columns,null,null,null,null,null);
|
String where = "not options & (1 <<1)";
|
||||||
|
Cursor cursor = db.query(Account.TABLENAME,columns,where,null,null,null,null);
|
||||||
try {
|
try {
|
||||||
while(cursor.moveToNext()) {
|
while(cursor.moveToNext()) {
|
||||||
jids.add(Jid.of(cursor.getString(0),cursor.getString(1),null));
|
jids.add(Jid.of(cursor.getString(0),cursor.getString(1),null));
|
||||||
|
|
|
@ -1663,7 +1663,6 @@ public class XmppConnectionService extends Service {
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
conversation = databaseBackend.findConversation(account, jid);
|
conversation = databaseBackend.findConversation(account, jid);
|
||||||
Log.d(Config.LOGTAG,"loaded from db: "+conversation.getNextMessage());
|
|
||||||
final boolean loadMessagesFromDb;
|
final boolean loadMessagesFromDb;
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
conversation.setStatus(Conversation.STATUS_AVAILABLE);
|
conversation.setStatus(Conversation.STATUS_AVAILABLE);
|
||||||
|
|
|
@ -86,7 +86,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
private TextInputLayout mAccountJidLayout;
|
private TextInputLayout mAccountJidLayout;
|
||||||
private EditText mPassword;
|
private EditText mPassword;
|
||||||
private TextInputLayout mPasswordLayout;
|
private TextInputLayout mPasswordLayout;
|
||||||
private CheckBox mRegisterNew;
|
|
||||||
private Button mCancelButton;
|
private Button mCancelButton;
|
||||||
private Button mSaveButton;
|
private Button mSaveButton;
|
||||||
private Button mDisableOsOptimizationsButton;
|
private Button mDisableOsOptimizationsButton;
|
||||||
|
@ -142,7 +141,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final boolean registerNewAccount = mRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI;
|
final boolean registerNewAccount = binding.accountRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI;
|
||||||
if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) {
|
if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) {
|
||||||
mAccountJidLayout.setError(getString(R.string.invalid_username));
|
mAccountJidLayout.setError(getString(R.string.invalid_username));
|
||||||
removeErrorsOnAllBut(mAccountJidLayout);
|
removeErrorsOnAllBut(mAccountJidLayout);
|
||||||
|
@ -483,7 +482,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
} else {
|
} else {
|
||||||
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
|
XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection();
|
||||||
URL url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null;
|
URL url = connection != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB ? connection.getRedirectionUrl() : null;
|
||||||
if (url != null && mRegisterNew.isChecked()) {
|
if (url != null && this.binding.accountRegisterNew.isChecked()) {
|
||||||
this.mSaveButton.setText(R.string.open_website);
|
this.mSaveButton.setText(R.string.open_website);
|
||||||
} else {
|
} else {
|
||||||
this.mSaveButton.setText(R.string.next);
|
this.mSaveButton.setText(R.string.next);
|
||||||
|
@ -545,7 +544,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
this.mPasswordLayout = (TextInputLayout) findViewById(R.id.account_password_layout);
|
this.mPasswordLayout = (TextInputLayout) findViewById(R.id.account_password_layout);
|
||||||
this.mAvatar = (ImageView) findViewById(R.id.avater);
|
this.mAvatar = (ImageView) findViewById(R.id.avater);
|
||||||
this.mAvatar.setOnClickListener(this.mAvatarClickListener);
|
this.mAvatar.setOnClickListener(this.mAvatarClickListener);
|
||||||
this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new);
|
|
||||||
this.mDisableOsOptimizationsButton = (Button) findViewById(R.id.os_optimization_disable);
|
this.mDisableOsOptimizationsButton = (Button) findViewById(R.id.os_optimization_disable);
|
||||||
this.getmDisableOsOptimizationsBody = (TextView) findViewById(R.id.os_optimization_body);
|
this.getmDisableOsOptimizationsBody = (TextView) findViewById(R.id.os_optimization_body);
|
||||||
this.mPgpFingerprintBox = (RelativeLayout) findViewById(R.id.pgp_fingerprint_box);
|
this.mPgpFingerprintBox = (RelativeLayout) findViewById(R.id.pgp_fingerprint_box);
|
||||||
|
@ -563,12 +561,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
this.mHostname.setOnFocusChangeListener(mEditTextFocusListener);
|
this.mHostname.setOnFocusChangeListener(mEditTextFocusListener);
|
||||||
this.mHostnameLayout = (TextInputLayout) findViewById(R.id.hostname_layout);
|
this.mHostnameLayout = (TextInputLayout) findViewById(R.id.hostname_layout);
|
||||||
this.mClearDevicesButton = (Button) findViewById(R.id.clear_devices);
|
this.mClearDevicesButton = (Button) findViewById(R.id.clear_devices);
|
||||||
this.mClearDevicesButton.setOnClickListener(new OnClickListener() {
|
this.mClearDevicesButton.setOnClickListener(v -> showWipePepDialog());
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
showWipePepDialog();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.mPort = (EditText) findViewById(R.id.port);
|
this.mPort = (EditText) findViewById(R.id.port);
|
||||||
this.mPort.setText("5222");
|
this.mPort.setText("5222");
|
||||||
this.mPort.addTextChangedListener(mTextWatcher);
|
this.mPort.addTextChangedListener(mTextWatcher);
|
||||||
|
@ -587,9 +580,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
updateSaveButton();
|
updateSaveButton();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.mRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword);
|
this.binding.accountRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword);
|
||||||
if (Config.DISALLOW_REGISTRATION_IN_UI) {
|
if (Config.DISALLOW_REGISTRATION_IN_UI) {
|
||||||
this.mRegisterNew.setVisibility(View.GONE);
|
this.binding.accountRegisterNew.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +654,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
this.mInitMode = init || this.jidToEdit == null;
|
this.mInitMode = init || this.jidToEdit == null;
|
||||||
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
|
this.messageFingerprint = getIntent().getStringExtra("fingerprint");
|
||||||
if (!mInitMode) {
|
if (!mInitMode) {
|
||||||
this.mRegisterNew.setVisibility(View.GONE);
|
this.binding.accountRegisterNew.setVisibility(View.GONE);
|
||||||
if (getSupportActionBar() != null) {
|
if (getSupportActionBar() != null) {
|
||||||
getSupportActionBar().setTitle(getString(R.string.account_details));
|
getSupportActionBar().setTitle(getString(R.string.account_details));
|
||||||
}
|
}
|
||||||
|
@ -966,8 +959,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.binding.accountRegisterNew.setVisibility(View.GONE);
|
this.binding.accountRegisterNew.setVisibility(View.GONE);
|
||||||
|
} else if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
|
||||||
|
this.binding.accountRegisterNew.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
this.binding.accountRegisterNew.setVisibility(mInitMode ? View.VISIBLE : View.GONE);
|
this.binding.accountRegisterNew.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
|
if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
|
||||||
Features features = this.mAccount.getXmppConnection().getFeatures();
|
Features features = this.mAccount.getXmppConnection().getFeatures();
|
||||||
|
|
Loading…
Reference in a new issue