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

@ -1,219 +1,224 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="?attr/color_background_secondary"> android:background="?attr/color_background_secondary">
<LinearLayout <LinearLayout
android:id="@+id/muc_main_layout" android:id="@+id/muc_main_layout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginTop="@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">
<TextView <TextView
android:id="@+id/muc_jabberid" android:id="@+id/muc_jabberid"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:text="@string/account_settings_example_jabber_id" android:text="@string/account_settings_example_jabber_id"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline" android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold"/> android:textStyle="bold"/>
<RelativeLayout <RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="32dp"> android:layout_marginBottom="32dp">
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/your_photo" android:id="@+id/your_photo"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:src="@drawable/ic_profile" android:src="@drawable/ic_profile"
app:riv_corner_radius="2dp" /> app:riv_corner_radius="2dp"/>
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@+id/your_photo" android:layout_toRightOf="@+id/your_photo"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="8dp"> android:paddingLeft="8dp">
<TextView <TextView
android:id="@+id/muc_your_nick" android:id="@+id/muc_your_nick"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeHeadline"/> android:textSize="?attr/TextSizeHeadline"/>
<TextView <TextView
android:id="@+id/muc_role" android:id="@+id/muc_role"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/> android:textSize="?attr/TextSizeBody"/>
</LinearLayout> </LinearLayout>
<ImageButton <ImageButton
android:id="@+id/edit_nick_button" android:id="@+id/edit_nick_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
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:background="?android:selectableItemBackground" android:alpha="?attr/icon_alpha"
android:padding="@dimen/image_button_padding" android:background="?android:selectableItemBackground"
android:alpha="?attr/icon_alpha" android:padding="@dimen/image_button_padding"
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"
<TextView android:id="@+id/muc_settings">
android:id="@+id/muc_conference_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/private_conference"
android:layout_centerVertical="true"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/change_conference_button"
/>
<ImageButton
android:id="@+id/change_conference_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_settings"/>
</RelativeLayout>
<RelativeLayout <TextView
android:layout_width="fill_parent" android:id="@+id/muc_conference_type"
android:layout_height="wrap_content"> android:layout_width="wrap_content"
<TextView android:layout_height="wrap_content"
android:id="@+id/notification_status_text" android:layout_alignParentLeft="true"
android:layout_width="wrap_content" android:layout_centerVertical="true"
android:layout_height="wrap_content" android:layout_toLeftOf="@+id/change_conference_button"
android:text="@string/notify_on_all_messages" android:text="@string/private_conference"
android:layout_centerVertical="true" 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
android:id="@+id/notification_status_button"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_notifications"/>
</RelativeLayout>
<TableLayout <ImageButton
android:layout_width="match_parent" android:id="@+id/change_conference_button"
android:layout_height="wrap_content" style="?android:attr/buttonStyleSmall"
android:id="@+id/muc_info_more" android:layout_width="wrap_content"
android:shrinkColumns="0" android:layout_height="wrap_content"
android:stretchColumns="1" android:layout_alignParentRight="true"
android:visibility="gone"> android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:src="?attr/icon_settings"/>
</RelativeLayout>
<TableRow <RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:id="@+id/notification_status_text"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="@string/server_info_mam" android:layout_height="wrap_content"
android:textColor="?attr/color_text_primary" android:layout_alignParentLeft="true"
android:textSize="?attr/TextSizeBody" android:layout_centerVertical="true"
android:singleLine="true" android:layout_toLeftOf="@+id/notification_status_button"
android:ellipsize="end" /> android:text="@string/notify_on_all_messages"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"
/>
<TextView <ImageButton
android:id="@+id/muc_info_mam" android:id="@+id/notification_status_button"
android:layout_width="wrap_content" style="?android:attr/buttonStyleSmall"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="right" android:layout_height="wrap_content"
android:paddingLeft="4dp" android:layout_alignParentRight="true"
android:textColor="?attr/color_text_primary" android:layout_centerVertical="true"
android:textSize="?attr/TextSizeBody" /> android:layout_gravity="center_horizontal"
</TableRow> android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:src="?attr/icon_notifications"/>
</RelativeLayout>
</TableLayout> <TableLayout
android:id="@+id/muc_info_more"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="0"
android:stretchColumns="1"
android:visibility="gone">
<TextView <TableRow
android:id="@+id/details_account" android:layout_width="fill_parent"
android:layout_width="wrap_content" android:layout_height="match_parent">
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="32dp"
android:text="@string/using_account"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"/>
</LinearLayout>
<LinearLayout <TextView
android:id="@+id/muc_more_details" android:layout_width="wrap_content"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:ellipsize="end"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:singleLine="true"
android:layout_marginRight="@dimen/activity_horizontal_margin" android:text="@string/server_info_mam"
android:layout_marginTop="@dimen/activity_vertical_margin" android:textColor="?attr/color_text_primary"
android:layout_marginBottom="@dimen/activity_vertical_margin" android:textSize="?attr/TextSizeBody"/>
android:background="?attr/infocard_border"
android:orientation="vertical" <TextView
android:padding="@dimen/infocard_padding"> android:id="@+id/muc_info_mam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:paddingLeft="4dp"
android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody"/>
</TableRow>
</TableLayout>
<TextView
android:id="@+id/details_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="32dp"
android:text="@string/using_account"
android:textColor="?attr/color_text_secondary"
android:textSize="?attr/TextSizeInfo"/>
</LinearLayout>
<LinearLayout
android:id="@+id/muc_more_details"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:background="?attr/infocard_border"
android:orientation="vertical"
android:padding="@dimen/infocard_padding">
<LinearLayout <LinearLayout
android:id="@+id/muc_members" android:id="@+id/muc_members"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:divider="?android:dividerHorizontal" android:divider="?android:dividerHorizontal"
android:orientation="vertical" android:orientation="vertical"
android:showDividers="middle"> android:showDividers="middle">
</LinearLayout> </LinearLayout>
<Button <Button
android:id="@+id/invite" android:id="@+id/invite"
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_gravity="center_horizontal"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:text="@string/invite_contact"/> android:text="@string/invite_contact"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>