From 01107e31ae22d84922742717ad5b7d87581e4096 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Tue, 21 Oct 2014 16:22:01 -0400 Subject: [PATCH] Add more server compatibility info. Hide server info behind a checkbox. Add XEP-0352 support to the server info list Add XEP-0237 to server info list Add XEP-0352 support to the server info list Add MaM and Blocking to the account XEPs list Also add a toggle button to hide some of the list Rebase on current codebase Make MAM string more descriptive Change show more button to checkbox menu item Shorten `MAM (History)' to `MAM' Order XEP list and hide all by default Supress warning (which is wrong anyways) Change `Show more' to `Show more info' --- .../conversations/ui/EditAccountActivity.java | 38 +++++- src/main/res/layout/activity_edit_account.xml | 108 +++++++++++++++++- src/main/res/menu/editaccount.xml | 7 ++ src/main/res/values/strings.xml | 5 + 4 files changed, 151 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 0dd7a2ebd..97efa41fb 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -19,6 +19,7 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import android.widget.TableLayout; import android.widget.TextView; import android.widget.Toast; @@ -42,10 +43,15 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate private CheckBox mRegisterNew; private Button mCancelButton; private Button mSaveButton; + private TableLayout mMoreTable; private LinearLayout mStats; private TextView mServerInfoSm; + private TextView mServerInfoRosterVersion; private TextView mServerInfoCarbons; + private TextView mServerInfoMam; + private TextView mServerInfoCSI; + private TextView mServerInfoBlocking; private TextView mServerInfoPep; private TextView mSessionEst; private TextView mOtrFingerprint; @@ -292,7 +298,11 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new); this.mStats = (LinearLayout) findViewById(R.id.stats); 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.mOtrFingerprint = (TextView) findViewById(R.id.otr_fingerprint); @@ -302,6 +312,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mCancelButton = (Button) findViewById(R.id.cancel_button); this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener); this.mCancelButton.setOnClickListener(this.mCancelButtonClickListener); + this.mMoreTable = (TableLayout) findViewById(R.id.server_info_more); this.mRegisterNew .setOnCheckedChangeListener(new OnCheckedChangeListener() { @@ -384,6 +395,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate intent.putExtra("account", mAccount.getJid().toString()); startActivity(intent); break; + case R.id.action_server_info_show_more: + mMoreTable.setVisibility(item.isChecked() ? View.GONE : View.VISIBLE); + item.setChecked(!item.isChecked()); } return super.onOptionsItemSelected(item); } @@ -406,16 +420,36 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate if (this.mAccount.getStatus() == Account.State.ONLINE && !this.mFetchingAvatar) { this.mStats.setVisibility(View.VISIBLE); - this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull( + this.mSessionEst.setText(UIHelper.readableTimeDifference( getApplicationContext(), this.mAccount.getXmppConnection() .getLastSessionEstablished())); - final Features features = this.mAccount.getXmppConnection().getFeatures(); + Features features = this.mAccount.getXmppConnection().getFeatures(); + if (features.rosterVersioning()) { + this.mServerInfoRosterVersion.setText(R.string.server_info_available); + } else { + this.mServerInfoRosterVersion.setText(R.string.server_info_unavailable); + } if (features.carbons()) { this.mServerInfoCarbons.setText(R.string.server_info_available); } else { this.mServerInfoCarbons .setText(R.string.server_info_unavailable); } + if (features.mam()) { + this.mServerInfoMam.setText(R.string.server_info_available); + } else { + this.mServerInfoMam.setText(R.string.server_info_unavailable); + } + if (features.csi()) { + this.mServerInfoCSI.setText(R.string.server_info_available); + } else { + this.mServerInfoCSI.setText(R.string.server_info_unavailable); + } + if (features.blocking()) { + this.mServerInfoBlocking.setText(R.string.server_info_available); + } else { + this.mServerInfoBlocking.setText(R.string.server_info_unavailable); + } if (features.sm()) { this.mServerInfoSm.setText(R.string.server_info_available); } else { diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index ed83cb9a2..a12766f9c 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -1,5 +1,6 @@ @@ -118,7 +119,8 @@ + android:layout_height="wrap_content" + tools:ignore="UselessParent"> + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded"/> + + + @@ -153,7 +164,29 @@ android:layout_height="wrap_content" android:layout_gravity="right" android:textColor="@color/primarytext" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -281,4 +379,4 @@ android:textColor="@color/secondarytext" /> - \ No newline at end of file + diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml index 5d10901eb..fc3628366 100644 --- a/src/main/res/menu/editaccount.xml +++ b/src/main/res/menu/editaccount.xml @@ -4,9 +4,16 @@ android:id="@+id/action_show_qr_code" android:title="@string/show_qr_code" android:showAsAction="never" /> + + \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index ba3051b23..29b813544 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -186,7 +186,12 @@ offline Conference Other Members + Server info + XEP-0313: MAM XEP-0280: Message Carbons + XEP-0352: Client State Indication + XEP-0191: Blocking Command + XEP-0237: Roster Versioning XEP-0198: Stream Management XEP-0163: PEP (Avatars) available