From 4d4586eaeaf65f88d6cdf353498aa5dfaf29ba99 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 15 Dec 2017 02:48:01 +0100 Subject: [PATCH] Conference Details: hide settings in offline mucs --- .../ui/ConferenceDetailsActivity.java | 14 +- src/main/res/layout/activity_muc_details.xml | 393 +++++++++--------- 2 files changed, 211 insertions(+), 196 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index d019834f3..c17c59611 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -16,6 +16,7 @@ import android.widget.Button; 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; @@ -59,6 +60,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private TextView mAccountJid; private LinearLayout membersView; private LinearLayout mMoreDetails; + private RelativeLayout mMucSettings; private TextView mConferenceType; private TableLayout mConferenceInfoTable; private TextView mConferenceInfoMam; @@ -235,6 +237,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mFullJid = (TextView) findViewById(R.id.muc_jabberid); membersView = (LinearLayout) findViewById(R.id.muc_members); mAccountJid = (TextView) findViewById(R.id.details_account); + mMucSettings = findViewById(R.id.muc_settings); mMoreDetails = (LinearLayout) findViewById(R.id.muc_more_details); mMoreDetails.setVisibility(View.GONE); mChangeConferenceSettingsButton = (ImageButton) findViewById(R.id.change_conference_button); @@ -267,7 +270,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers }); 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.mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE); this.mConferenceInfoMam = (TextView) findViewById(R.id.muc_info_mam); this.mNotifyStatusButton = (ImageButton) findViewById(R.id.notification_status_button); this.mNotifyStatusButton.setOnClickListener(this.mNotifyStatusClickListener); @@ -312,7 +315,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers this.mAdvancedMode = !menuItem.isChecked(); menuItem.setChecked(this.mAdvancedMode); getPreferences().edit().putBoolean("advanced_muc_mode", mAdvancedMode).apply(); - mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE); + final boolean online = mConversation != null && mConversation.getMucOptions().online(); + mConferenceInfoTable.setVisibility(this.mAdvancedMode && online ? View.VISIBLE : View.GONE); invalidateOptionsMenu(); updateView(); break; @@ -548,6 +552,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers TextView mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); if (mucOptions.online()) { mMoreDetails.setVisibility(View.VISIBLE); + mMucSettings.setVisibility(View.VISIBLE); + mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE); final String status = getStatus(self); if (status != null) { mRoleAffiliaton.setVisibility(View.VISIBLE); @@ -570,6 +576,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } else { mChangeConferenceSettingsButton.setVisibility(View.GONE); } + } else { + mMoreDetails.setVisibility(View.GONE); + mMucSettings.setVisibility(View.GONE); + mConferenceInfoTable.setVisibility(View.GONE); } int ic_notifications = getThemeResource(R.attr.icon_notifications, R.drawable.ic_notifications_black_24dp); diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index 56b7f90b8..f91370a94 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -1,219 +1,224 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="?attr/color_background_secondary"> - + - + - + - + - + - + - + - - + + - - + + - - - - + - - - - + - + + - + - + - - + + - + - - + - + + + + + + + + + + + - - + + -