make safe button work
This commit is contained in:
parent
1f3b4e2ccf
commit
64aa238d57
|
@ -2538,14 +2538,6 @@ public class XmppConnectionService extends Service {
|
|||
public void pushSubjectToConference(final Conversation conference, final String subject) {
|
||||
MessagePacket packet = this.getMessageGenerator().conferenceSubject(conference, subject);
|
||||
this.sendMessagePacket(conference.getAccount(), packet);
|
||||
final MucOptions mucOptions = conference.getMucOptions();
|
||||
final MucOptions.User self = mucOptions.getSelf();
|
||||
if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
|
||||
Bundle options = new Bundle();
|
||||
options.putString("muc#roomconfig_persistentroom", "1");
|
||||
options.putString("muc#roomconfig_roomname", subject);
|
||||
this.pushConferenceConfiguration(conference, options, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeAffiliationInConference(final Conversation conference, Jid user, final MucOptions.Affiliation affiliation, final OnAffiliationChanged callback) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.os.Bundle;
|
|||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -182,14 +183,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
builder.create().show();
|
||||
}
|
||||
};
|
||||
private OnValueEdited onSubjectEdited = new OnValueEdited() {
|
||||
|
||||
@Override
|
||||
public String onValueEdited(String value) {
|
||||
xmppConnectionService.pushSubjectToConference(mConversation, value.trim().isEmpty() ? null : value.trim());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
public static boolean cancelPotentialWork(User user, ImageView imageView) {
|
||||
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
|
||||
|
@ -339,11 +332,39 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
if (!owner) {
|
||||
this.binding.mucEditSubject.requestFocus();
|
||||
}
|
||||
this.binding.yourPhoto.setVisibility(View.GONE);
|
||||
} else {
|
||||
String subject = this.binding.mucEditSubject.isEnabled() ? this.binding.mucEditSubject.getEditableText().toString().trim() : null;
|
||||
String name = this.binding.mucEditTitle.isEnabled() ? this.binding.mucEditTitle.getEditableText().toString().trim() : null;
|
||||
onMucInfoUpdated(subject, name);
|
||||
hideEditor();
|
||||
}
|
||||
}
|
||||
|
||||
private void hideEditor() {
|
||||
this.binding.mucEditor.setVisibility(View.GONE);
|
||||
this.binding.mucDisplay.setVisibility(View.VISIBLE);
|
||||
this.binding.editMucNameButton.setImageResource(getThemeResource(R.attr.icon_edit_body, R.drawable.ic_edit_black_24dp));
|
||||
this.binding.yourPhoto.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void onMucInfoUpdated(String subject, String name) {
|
||||
final MucOptions mucOptions = mConversation.getMucOptions();
|
||||
if (mucOptions.canChangeSubject() && !blankOnNull(mucOptions.getSubject()).equals(subject)) {
|
||||
Log.d(Config.LOGTAG,"subject changed");
|
||||
xmppConnectionService.pushSubjectToConference(mConversation, subject);
|
||||
}
|
||||
if (mucOptions.getSelf().getAffiliation().ranks(MucOptions.Affiliation.OWNER) && !blankOnNull(mucOptions.getName()).equals(name)) {
|
||||
Log.d(Config.LOGTAG,"name changed");
|
||||
Bundle options = new Bundle();
|
||||
options.putString("muc#roomconfig_persistentroom", "1");
|
||||
options.putString("muc#roomconfig_roomname", name);
|
||||
xmppConnectionService.pushConferenceConfiguration(mConversation, options, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static String blankOnNull(String input) {
|
||||
return input == null ? "" : input;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -558,6 +579,15 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (this.binding.mucEditor.getVisibility() == View.VISIBLE) {
|
||||
hideEditor();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateView() {
|
||||
invalidateOptionsMenu();
|
||||
final MucOptions mucOptions = mConversation.getMucOptions();
|
||||
|
|
|
@ -46,15 +46,15 @@
|
|||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_alignParentStart="true"
|
||||
app:riv_corner_radius="2dp"/>
|
||||
app:riv_corner_radius="2dp"
|
||||
android:layout_marginEnd="@dimen/avatar_item_distance"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toEndOf="@+id/your_photo"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/avatar_item_distance">
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue