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

@ -14,10 +14,10 @@
<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:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="?attr/infocard_border"
android:orientation="vertical"
android:padding="@dimen/infocard_padding">
@ -76,72 +76,77 @@
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:alpha="?attr/icon_alpha"
android:src="?attr/icon_edit_body"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:id="@+id/muc_settings">
<TextView
android:id="@+id/muc_conference_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/private_conference"
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"
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:layout_gravity="center_horizontal"
android:alpha="?attr/icon_alpha"
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">
<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_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"
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:layout_gravity="center_horizontal"
android:alpha="?attr/icon_alpha"
android:background="?android:selectableItemBackground"
android:padding="@dimen/image_button_padding"
android:alpha="?attr/icon_alpha"
android:src="?attr/icon_notifications"/>
</RelativeLayout>
<TableLayout
android:id="@+id/muc_info_more"
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">
@ -153,11 +158,11 @@
<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"
android:singleLine="true"
android:ellipsize="end" />
android:textSize="?attr/TextSizeBody"/>
<TextView
android:id="@+id/muc_info_mam"
@ -186,10 +191,10 @@
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:layout_marginBottom="@dimen/activity_vertical_margin"
android:background="?attr/infocard_border"
android:orientation="vertical"
android:padding="@dimen/infocard_padding">