hide register account checkbox in magic mode

This commit is contained in:
Daniel Gultsch 2018-03-08 15:18:44 +01:00
parent a2028b203f
commit e89378ceae
1 changed files with 32 additions and 50 deletions

View File

@ -93,16 +93,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private TextView getmDisableOsOptimizationsBody; private TextView getmDisableOsOptimizationsBody;
private TableLayout mMoreTable; private TableLayout mMoreTable;
private TextView mServerInfoSm;
private TextView mServerInfoRosterVersion;
private TextView mServerInfoCarbons;
private TextView mServerInfoMam;
private TextView mServerInfoCSI;
private TextView mServerInfoBlocking;
private TextView mServerInfoPep;
private TextView mServerInfoHttpUpload;
private TextView mServerInfoPush;
private TextView mSessionEst;
private TextView mAxolotlFingerprint; private TextView mAxolotlFingerprint;
private TextView mPgpFingerprint; private TextView mPgpFingerprint;
private TextView mOwnFingerprintDesc; private TextView mOwnFingerprintDesc;
@ -281,7 +271,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
}; };
private Toast mFetchingMamPrefsToast; private Toast mFetchingMamPrefsToast;
private TableRow mPushRow;
private String mSavedInstanceAccount; private String mSavedInstanceAccount;
private boolean mSavedInstanceInit = false; private boolean mSavedInstanceInit = false;
private Button mClearDevicesButton; private Button mClearDevicesButton;
@ -559,17 +548,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new); 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.mSessionEst = (TextView) findViewById(R.id.session_est);
this.mServerInfoRosterVersion = (TextView) findViewById(R.id.server_info_roster_version);
this.mServerInfoCarbons = (TextView) findViewById(R.id.server_info_carbons);
this.mServerInfoMam = (TextView) findViewById(R.id.server_info_mam);
this.mServerInfoCSI = (TextView) findViewById(R.id.server_info_csi);
this.mServerInfoBlocking = (TextView) findViewById(R.id.server_info_blocking);
this.mServerInfoSm = (TextView) findViewById(R.id.server_info_sm);
this.mServerInfoPep = (TextView) findViewById(R.id.server_info_pep);
this.mServerInfoHttpUpload = (TextView) findViewById(R.id.server_info_http_upload);
this.mPushRow = (TableRow) findViewById(R.id.push_row);
this.mServerInfoPush = (TextView) findViewById(R.id.server_info_push);
this.mPgpFingerprintBox = (RelativeLayout) findViewById(R.id.pgp_fingerprint_box); this.mPgpFingerprintBox = (RelativeLayout) findViewById(R.id.pgp_fingerprint_box);
this.mPgpFingerprint = (TextView) findViewById(R.id.pgp_fingerprint); this.mPgpFingerprint = (TextView) findViewById(R.id.pgp_fingerprint);
this.getmPgpFingerprintDesc = (TextView) findViewById(R.id.pgp_fingerprint_desc); this.getmPgpFingerprintDesc = (TextView) findViewById(R.id.pgp_fingerprint_desc);
@ -979,12 +957,17 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} else { } else {
this.mAvatar.setVisibility(View.GONE); this.mAvatar.setVisibility(View.GONE);
} }
if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) { this.binding.accountRegisterNew.setChecked(this.mAccount.isOptionSet(Account.OPTION_REGISTER));
this.mRegisterNew.setVisibility(View.VISIBLE); if (this.mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) {
this.mRegisterNew.setChecked(true); if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.create_account);
}
}
this.binding.accountRegisterNew.setVisibility(View.GONE);
} else { } else {
this.mRegisterNew.setVisibility(View.GONE); this.binding.accountRegisterNew.setVisibility(mInitMode ? View.VISIBLE : View.GONE);
this.mRegisterNew.setChecked(false);
} }
if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) { if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
Features features = this.mAccount.getXmppConnection().getFeatures(); Features features = this.mAccount.getXmppConnection().getFeatures();
@ -992,63 +975,62 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
boolean showBatteryWarning = !xmppConnectionService.getPushManagementService().available(mAccount) && isOptimizingBattery(); boolean showBatteryWarning = !xmppConnectionService.getPushManagementService().available(mAccount) && isOptimizingBattery();
boolean showDataSaverWarning = isAffectedByDataSaver(); boolean showDataSaverWarning = isAffectedByDataSaver();
showOsOptimizationWarning(showBatteryWarning, showDataSaverWarning); showOsOptimizationWarning(showBatteryWarning, showDataSaverWarning);
this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection() this.binding.sessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection()
.getLastSessionEstablished())); .getLastSessionEstablished()));
if (features.rosterVersioning()) { if (features.rosterVersioning()) {
this.mServerInfoRosterVersion.setText(R.string.server_info_available); this.binding.serverInfoRosterVersion.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoRosterVersion.setText(R.string.server_info_unavailable); this.binding.serverInfoRosterVersion.setText(R.string.server_info_unavailable);
} }
if (features.carbons()) { if (features.carbons()) {
this.mServerInfoCarbons.setText(R.string.server_info_available); this.binding.serverInfoCarbons.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoCarbons this.binding.serverInfoCarbons.setText(R.string.server_info_unavailable);
.setText(R.string.server_info_unavailable);
} }
if (features.mam()) { if (features.mam()) {
this.mServerInfoMam.setText(R.string.server_info_available); this.binding.serverInfoMam.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoMam.setText(R.string.server_info_unavailable); this.binding.serverInfoMam.setText(R.string.server_info_unavailable);
} }
if (features.csi()) { if (features.csi()) {
this.mServerInfoCSI.setText(R.string.server_info_available); this.binding.serverInfoCsi.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoCSI.setText(R.string.server_info_unavailable); this.binding.serverInfoCsi.setText(R.string.server_info_unavailable);
} }
if (features.blocking()) { if (features.blocking()) {
this.mServerInfoBlocking.setText(R.string.server_info_available); this.binding.serverInfoBlocking.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoBlocking.setText(R.string.server_info_unavailable); this.binding.serverInfoBlocking.setText(R.string.server_info_unavailable);
} }
if (features.sm()) { if (features.sm()) {
this.mServerInfoSm.setText(R.string.server_info_available); this.binding.serverInfoSm.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoSm.setText(R.string.server_info_unavailable); this.binding.serverInfoSm.setText(R.string.server_info_unavailable);
} }
if (features.pep()) { if (features.pep()) {
AxolotlService axolotlService = this.mAccount.getAxolotlService(); AxolotlService axolotlService = this.mAccount.getAxolotlService();
if (axolotlService != null && axolotlService.isPepBroken()) { if (axolotlService != null && axolotlService.isPepBroken()) {
this.mServerInfoPep.setText(R.string.server_info_broken); this.binding.serverInfoPep.setText(R.string.server_info_broken);
} else if (features.pepPublishOptions() || features.pepOmemoWhitelisted()) { } else if (features.pepPublishOptions() || features.pepOmemoWhitelisted()) {
this.mServerInfoPep.setText(R.string.server_info_available); this.binding.serverInfoPep.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoPep.setText(R.string.server_info_partial); this.binding.serverInfoPep.setText(R.string.server_info_partial);
} }
} else { } else {
this.mServerInfoPep.setText(R.string.server_info_unavailable); this.binding.serverInfoPep.setText(R.string.server_info_unavailable);
} }
if (features.httpUpload(0)) { if (features.httpUpload(0)) {
this.mServerInfoHttpUpload.setText(R.string.server_info_available); this.binding.serverInfoHttpUpload.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoHttpUpload.setText(R.string.server_info_unavailable); this.binding.serverInfoHttpUpload.setText(R.string.server_info_unavailable);
} }
this.mPushRow.setVisibility(xmppConnectionService.getPushManagementService().isStub() ? View.GONE : View.VISIBLE); this.binding.pushRow.setVisibility(xmppConnectionService.getPushManagementService().isStub() ? View.GONE : View.VISIBLE);
if (xmppConnectionService.getPushManagementService().available(mAccount)) { if (xmppConnectionService.getPushManagementService().available(mAccount)) {
this.mServerInfoPush.setText(R.string.server_info_available); this.binding.serverInfoPush.setText(R.string.server_info_available);
} else { } else {
this.mServerInfoPush.setText(R.string.server_info_unavailable); this.binding.serverInfoPush.setText(R.string.server_info_unavailable);
} }
final long pgpKeyId = this.mAccount.getPgpId(); final long pgpKeyId = this.mAccount.getPgpId();
if (pgpKeyId != 0 && Config.supportOpenPgp()) { if (pgpKeyId != 0 && Config.supportOpenPgp()) {