diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-07 23:51:27 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-07 23:51:27 +0200 |
commit | 102f1abea814aaced85d1ba4be949a61d1981c1e (patch) | |
tree | 72d12a742fee1e67740311917a1dead4d64ab68f /src/main/java/de/pixart/messenger | |
parent | eabedee9444409c9de5f779e5f392440989db52e (diff) |
fix register account checkbox glitch
Diffstat (limited to '')
3 files changed, 10 insertions, 16 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index 4a25a3af5..6013ca7e9 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -788,7 +788,8 @@ public class DatabaseBackend extends SQLiteOpenHelper { SQLiteDatabase db = this.getReadableDatabase(); final List<Jid> jids = new ArrayList<>(); 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 { while (cursor.moveToNext()) { jids.add(Jid.of(cursor.getString(0), cursor.getString(1), null)); diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index cfdf14f9a..b6c5047ae 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1853,7 +1853,6 @@ public class XmppConnectionService extends Service { return conversation; } conversation = databaseBackend.findConversation(account, jid); - Log.d(Config.LOGTAG, "loaded from db: " + conversation.getNextMessage()); final boolean loadMessagesFromDb; if (conversation != null) { conversation.setStatus(Conversation.STATUS_AVAILABLE); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 3d977d96c..8985c19cf 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -28,7 +28,6 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; -import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; @@ -83,7 +82,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private TextInputLayout mAccountJidLayout; private EditText mPassword; private TextInputLayout mPasswordLayout; - private CheckBox mRegisterNew; private Button mCancelButton; private Button mSaveButton; private Button mDisableOsOptimizationsButton; @@ -143,7 +141,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } 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("@")) { mAccountJidLayout.setError(getString(R.string.invalid_username)); removeErrorsOnAllBut(mAccountJidLayout); @@ -492,7 +490,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } else { XmppConnection connection = mAccount == null ? null : mAccount.getXmppConnection(); 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); } else { this.mSaveButton.setText(R.string.next); @@ -554,7 +552,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mPasswordLayout = (TextInputLayout) findViewById(R.id.account_password_layout); this.mAvatar = findViewById(R.id.avater); this.mAvatar.setOnClickListener(this.mAvatarClickListener); - this.mRegisterNew = findViewById(R.id.account_register_new); this.mDisableOsOptimizationsButton = findViewById(R.id.os_optimization_disable); this.getmDisableOsOptimizationsBody = findViewById(R.id.os_optimization_body); this.mPgpFingerprintBox = findViewById(R.id.pgp_fingerprint_box); @@ -576,12 +573,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mHostname.setOnFocusChangeListener(mEditTextFocusListener); this.mHostnameLayout = (TextInputLayout)findViewById(R.id.hostname_layout); this.mClearDevicesButton = findViewById(R.id.clear_devices); - this.mClearDevicesButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - showWipePepDialog(); - } - }); + this.mClearDevicesButton.setOnClickListener(v -> showWipePepDialog()); this.mPort = findViewById(R.id.port); this.mPort.setText("5222"); this.mPort.addTextChangedListener(mTextWatcher); @@ -600,9 +592,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat updateSaveButton(); } }; - this.mRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword); + this.binding.accountRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword); if (Config.DISALLOW_REGISTRATION_IN_UI) { - this.mRegisterNew.setVisibility(View.GONE); + this.binding.accountRegisterNew.setVisibility(View.GONE); } } @@ -688,7 +680,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mInitMode = init || this.jidToEdit == null; this.messageFingerprint = getIntent().getStringExtra("fingerprint"); if (!mInitMode) { - this.mRegisterNew.setVisibility(View.GONE); + this.binding.accountRegisterNew.setVisibility(View.GONE); if (getSupportActionBar() != null) { getSupportActionBar().setTitle(getString(R.string.account_details)); } @@ -1013,6 +1005,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } } this.binding.accountRegisterNew.setVisibility(View.GONE); + } else if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) { + this.binding.accountRegisterNew.setVisibility(View.VISIBLE); } else { this.binding.accountRegisterNew.setVisibility(mInitMode ? View.VISIBLE : View.GONE); } |