Show whether MAM is supported in MUCs

The conference details in "Advanced Mode" now indicate whether MAM is
supported by the conference server.
This commit is contained in:
saqura 2015-10-02 22:00:11 +02:00 committed by Daniel Gultsch
parent 32abc76689
commit 403db3b080
3 changed files with 47 additions and 2 deletions

View File

@ -247,6 +247,11 @@ public class MucOptions {
return hasFeature("muc_membersonly"); return hasFeature("muc_membersonly");
} }
public boolean mamSupport() {
// Update with "urn:xmpp:mam:1" once we support it
return hasFeature("urn:xmpp:mam:0");
}
public boolean nonanonymous() { public boolean nonanonymous() {
return hasFeature("muc_nonanonymous"); return hasFeature("muc_nonanonymous");
} }

View File

@ -19,6 +19,7 @@ import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -61,6 +62,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private LinearLayout membersView; private LinearLayout membersView;
private LinearLayout mMoreDetails; private LinearLayout mMoreDetails;
private TextView mConferenceType; private TextView mConferenceType;
private TableLayout mConferenceInfoTable;
private TextView mConferenceInfoMam;
private ImageButton mChangeConferenceSettingsButton; private ImageButton mChangeConferenceSettingsButton;
private Button mInviteButton; private Button mInviteButton;
private String uuid = null; private String uuid = null;
@ -194,7 +197,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
mMoreDetails.setVisibility(View.GONE); mMoreDetails.setVisibility(View.GONE);
mChangeConferenceSettingsButton = (ImageButton) findViewById(R.id.change_conference_button); mChangeConferenceSettingsButton = (ImageButton) findViewById(R.id.change_conference_button);
mChangeConferenceSettingsButton.setOnClickListener(this.mChangeConferenceSettings); mChangeConferenceSettingsButton.setOnClickListener(this.mChangeConferenceSettings);
mConferenceType = (TextView) findViewById(R.id.muc_conference_type);
mInviteButton = (Button) findViewById(R.id.invite); mInviteButton = (Button) findViewById(R.id.invite);
mInviteButton.setOnClickListener(inviteListener); mInviteButton.setOnClickListener(inviteListener);
mConferenceType = (TextView) findViewById(R.id.muc_conference_type); mConferenceType = (TextView) findViewById(R.id.muc_conference_type);
@ -217,6 +219,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} }
}); });
this.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false); this.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false);
this.mConferenceInfoTable = (TableLayout) findViewById(R.id.muc_info_more);
mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
this.mConferenceInfoMam = (TextView) findViewById(R.id.muc_info_mam);
} }
@Override @Override
@ -240,6 +245,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
this.mAdvancedMode = !menuItem.isChecked(); this.mAdvancedMode = !menuItem.isChecked();
menuItem.setChecked(this.mAdvancedMode); menuItem.setChecked(this.mAdvancedMode);
getPreferences().edit().putBoolean("advanced_muc_mode", mAdvancedMode).commit(); getPreferences().edit().putBoolean("advanced_muc_mode", mAdvancedMode).commit();
mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
invalidateOptionsMenu(); invalidateOptionsMenu();
updateView(); updateView();
break; break;
@ -473,6 +479,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} else { } else {
mConferenceType.setText(R.string.public_conference); mConferenceType.setText(R.string.public_conference);
} }
if (mucOptions.mamSupport()) {
mConferenceInfoMam.setText(R.string.server_info_available);
} else {
mConferenceInfoMam.setText(R.string.server_info_unavailable);
}
if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) { if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
mChangeConferenceSettingsButton.setVisibility(View.VISIBLE); mChangeConferenceSettingsButton.setVisibility(View.VISIBLE);
} else { } else {

View File

@ -107,6 +107,35 @@
android:src="?attr/icon_settings"/> android:src="?attr/icon_settings"/>
</RelativeLayout> </RelativeLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/muc_info_more"
android:stretchColumns="1"
android:visibility="gone">
<TableRow
android:layout_width="fill_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/server_info_mam"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" />
<TextView
android:id="@+id/muc_info_mam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeBody" />
</TableRow>
</TableLayout>
<TextView <TextView
android:id="@+id/details_account" android:id="@+id/details_account"
android:layout_width="wrap_content" android:layout_width="wrap_content"