Conference Details: hide settings in offline mucs

This commit is contained in:
Daniel Gultsch 2017-12-15 02:48:01 +01:00
parent 811abedf67
commit 4d4586eaea
2 changed files with 211 additions and 196 deletions

View file

@ -16,6 +16,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.RelativeLayout;
import android.widget.TableLayout; import android.widget.TableLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -59,6 +60,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private TextView mAccountJid; private TextView mAccountJid;
private LinearLayout membersView; private LinearLayout membersView;
private LinearLayout mMoreDetails; private LinearLayout mMoreDetails;
private RelativeLayout mMucSettings;
private TextView mConferenceType; private TextView mConferenceType;
private TableLayout mConferenceInfoTable; private TableLayout mConferenceInfoTable;
private TextView mConferenceInfoMam; private TextView mConferenceInfoMam;
@ -235,6 +237,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
mFullJid = (TextView) findViewById(R.id.muc_jabberid); mFullJid = (TextView) findViewById(R.id.muc_jabberid);
membersView = (LinearLayout) findViewById(R.id.muc_members); membersView = (LinearLayout) findViewById(R.id.muc_members);
mAccountJid = (TextView) findViewById(R.id.details_account); mAccountJid = (TextView) findViewById(R.id.details_account);
mMucSettings = findViewById(R.id.muc_settings);
mMoreDetails = (LinearLayout) findViewById(R.id.muc_more_details); mMoreDetails = (LinearLayout) findViewById(R.id.muc_more_details);
mMoreDetails.setVisibility(View.GONE); mMoreDetails.setVisibility(View.GONE);
mChangeConferenceSettingsButton = (ImageButton) findViewById(R.id.change_conference_button); 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.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false);
this.mConferenceInfoTable = (TableLayout) findViewById(R.id.muc_info_more); 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.mConferenceInfoMam = (TextView) findViewById(R.id.muc_info_mam);
this.mNotifyStatusButton = (ImageButton) findViewById(R.id.notification_status_button); this.mNotifyStatusButton = (ImageButton) findViewById(R.id.notification_status_button);
this.mNotifyStatusButton.setOnClickListener(this.mNotifyStatusClickListener); this.mNotifyStatusButton.setOnClickListener(this.mNotifyStatusClickListener);
@ -312,7 +315,8 @@ 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).apply(); 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(); invalidateOptionsMenu();
updateView(); updateView();
break; break;
@ -548,6 +552,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
TextView mRoleAffiliaton = (TextView) findViewById(R.id.muc_role); TextView mRoleAffiliaton = (TextView) findViewById(R.id.muc_role);
if (mucOptions.online()) { if (mucOptions.online()) {
mMoreDetails.setVisibility(View.VISIBLE); mMoreDetails.setVisibility(View.VISIBLE);
mMucSettings.setVisibility(View.VISIBLE);
mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE);
final String status = getStatus(self); final String status = getStatus(self);
if (status != null) { if (status != null) {
mRoleAffiliaton.setVisibility(View.VISIBLE); mRoleAffiliaton.setVisibility(View.VISIBLE);
@ -570,6 +576,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} else { } else {
mChangeConferenceSettingsButton.setVisibility(View.GONE); 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); int ic_notifications = getThemeResource(R.attr.icon_notifications, R.drawable.ic_notifications_black_24dp);

View file

@ -14,10 +14,10 @@
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="?attr/infocard_border" android:background="?attr/infocard_border"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/infocard_padding"> android:padding="@dimen/infocard_padding">
@ -76,72 +76,77 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_edit_body"/> android:src="?attr/icon_edit_body"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:id="@+id/muc_settings">
<TextView <TextView
android:id="@+id/muc_conference_type" android:id="@+id/muc_conference_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/private_conference" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/change_conference_button"
android:text="@string/private_conference"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/change_conference_button"
/> />
<ImageButton <ImageButton
android:id="@+id/change_conference_button" android:id="@+id/change_conference_button"
style="?android:attr/buttonStyleSmall" style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_settings"/> android:src="?attr/icon_settings"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/notification_status_text" android:id="@+id/notification_status_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/notify_on_all_messages" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/notification_status_button"
android:text="@string/notify_on_all_messages"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/notification_status_button"
/> />
<ImageButton <ImageButton
android:id="@+id/notification_status_button" android:id="@+id/notification_status_button"
style="?android:attr/buttonStyleSmall" style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding" android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_notifications"/> android:src="?attr/icon_notifications"/>
</RelativeLayout> </RelativeLayout>
<TableLayout <TableLayout
android:id="@+id/muc_info_more"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/muc_info_more"
android:shrinkColumns="0" android:shrinkColumns="0"
android:stretchColumns="1" android:stretchColumns="1"
android:visibility="gone"> android:visibility="gone">
@ -153,11 +158,11 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/server_info_mam" android:text="@string/server_info_mam"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" android:textSize="?attr/TextSizeBody"/>
android:singleLine="true"
android:ellipsize="end" />
<TextView <TextView
android:id="@+id/muc_info_mam" android:id="@+id/muc_info_mam"
@ -186,10 +191,10 @@
android:id="@+id/muc_more_details" android:id="@+id/muc_more_details"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="?attr/infocard_border" android:background="?attr/infocard_border"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/infocard_padding"> android:padding="@dimen/infocard_padding">