diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-09-20 16:43:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-20 16:43:51 +0200 |
commit | de7c0c5121ac4436b9172d35bfe44a45865c25be (patch) | |
tree | 192ee8d187f29d57bfd97b4069ac3bfc89613990 /src/main/java/eu | |
parent | 5790d4c4ab6faa0ea390ca92833bbc3315d813e0 (diff) | |
parent | 9aaa5b78f4264c607ee4a1e0c7b94085cd022e79 (diff) |
Merge pull request #2028 from Mishiranu/feature-more-tables
Fix "Server info" table layout
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 83364ca2..cc178179 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -519,6 +519,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener); this.mCancelButton.setOnClickListener(this.mCancelButtonClickListener); this.mMoreTable = (TableLayout) findViewById(R.id.server_info_more); + if (savedInstanceState != null && savedInstanceState.getBoolean("showMoreTable")) { + changeMoreTableVisibility(true); + } final OnCheckedChangeListener OnCheckedShowConfirmPassword = new OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, @@ -585,6 +588,15 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } @Override + public boolean onPrepareOptionsMenu(Menu menu) { + final MenuItem showMoreInfo = menu.findItem(R.id.action_server_info_show_more); + if (showMoreInfo.isVisible()) { + showMoreInfo.setChecked(mMoreTable.getVisibility() == View.VISIBLE); + } + return super.onPrepareOptionsMenu(menu); + } + + @Override protected void onStart() { super.onStart(); final int theme = findTheme(); @@ -628,6 +640,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate if (mAccount != null) { savedInstanceState.putString("account", mAccount.getJid().toBareJid().toString()); savedInstanceState.putBoolean("initMode", mInitMode); + savedInstanceState.putBoolean("showMoreTable", mMoreTable.getVisibility() == View.VISIBLE); } super.onSaveInstanceState(savedInstanceState); } @@ -695,8 +708,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate startActivity(showBlocklistIntent); break; case R.id.action_server_info_show_more: - mMoreTable.setVisibility(item.isChecked() ? View.GONE : View.VISIBLE); - item.setChecked(!item.isChecked()); + changeMoreTableVisibility(!item.isChecked()); break; case R.id.action_change_password_on_server: gotoChangePassword(null); @@ -720,6 +732,10 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate return super.onOptionsItemSelected(item); } + private void changeMoreTableVisibility(boolean visible) { + mMoreTable.setVisibility(visible ? View.VISIBLE : View.GONE); + } + private void gotoChangePassword(String newPassword) { final Intent changePasswordIntent = new Intent(this, ChangePasswordActivity.class); changePasswordIntent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toString()); |