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.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);

View File

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