renaming conferences over conference details

This commit is contained in:
Daniel Gultsch 2014-03-14 23:32:48 +01:00
parent b1a3d09ca6
commit b0d57d01c4
3 changed files with 92 additions and 35 deletions

View file

@ -8,6 +8,53 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
style="@style/sectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Conference" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#eee" >
<EditText
android:id="@+id/muc_subject"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/muc_edit_subject"
android:background="#eee"
android:ems="10"
android:hint="Conferenece Subject"
android:inputType="textEmailAddress"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="12dp" />
<ImageButton
android:id="@+id/muc_edit_subject"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:background="?android:selectableItemBackground"
android:padding="8dp"
android:src="@drawable/ic_action_edit" />
</RelativeLayout>
<TextView
android:id="@+id/muc_jabberid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:singleLine="true"
android:textColor="#5b5b5b"
android:textSize="18sp"/>
<TextView
style="@style/sectionHeader"
@ -16,12 +63,13 @@
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:text="Your nickname" />
android:text="Your Nickname" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#eee" >
<EditText
android:id="@+id/muc_your_nick"
@ -31,7 +79,7 @@
android:layout_toLeftOf="@+id/muc_edit_nick"
android:background="#eee"
android:ems="10"
android:hint="Search or enter Jabber ID"
android:hint="Your nickname"
android:inputType="textEmailAddress"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
@ -49,35 +97,6 @@
android:padding="8dp"
android:src="@drawable/ic_action_edit" />
</RelativeLayout>
<TextView
style="@style/sectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Jabber ID" />
<TextView
android:id="@+id/muc_jabberid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:singleLine="true"
android:textColor="#5b5b5b"
android:textSize="18sp"/>
<LinearLayout
android:id="@+id/muc_more_details"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
style="@style/sectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="Your role" />
<TextView
android:id="@+id/muc_role"
android:layout_width="wrap_content"
@ -86,7 +105,12 @@
android:singleLine="true"
android:textSize="18sp"
android:textColor="#5b5b5b"/>
<LinearLayout
android:id="@+id/muc_more_details"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/muc_participants_header"

View file

@ -1231,4 +1231,19 @@ public class XmppConnectionService extends Service {
convChangedListener.onConversationListChanged();
}
}
public void sendConversationSubject(Conversation conversation,
String subject) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_GROUPCHAT);
packet.setTo(conversation.getContactJid().split("/")[0]);
Element subjectChild = new Element("subject");
subjectChild.setContent(subject);
packet.addChild(subjectChild);
packet.setFrom(conversation.getAccount().getJid());
Account account = conversation.getAccount();
if (account.getStatus() == Account.STATUS_ONLINE) {
account.getXmppConnection().sendMessagePacket(packet);
}
}
}

View file

@ -30,12 +30,12 @@ public class MucDetailsActivity extends XmppActivity {
public static final String ACTION_VIEW_MUC = "view_muc";
private Conversation conversation;
private EditText mYourNick;
private EditText mSubject;
private TextView mRoleAffiliaton;
private TextView mFullJid;
private LinearLayout membersView;
private LinearLayout mMoreDetails;
private String uuid = null;
private ArrayAdapter<User> contactsAdapter;
private OnClickListener changeNickListener = new OnClickListener() {
@Override
@ -50,6 +50,20 @@ public class MucDetailsActivity extends XmppActivity {
}
}
};
private OnClickListener changeSubjectListener = new OnClickListener() {
@Override
public void onClick(View arg0) {
String subject = mSubject.getText().toString();
MucOptions options = conversation.getMucOptions();
if (!subject.equals(options.getSubject())) {
xmppConnectionService.sendConversationSubject(conversation,subject);
finish();
}
}
};
private List<User> users = new ArrayList<MucOptions.User>();
@Override
@ -61,11 +75,14 @@ public class MucDetailsActivity extends XmppActivity {
setContentView(R.layout.activity_muc_details);
mYourNick = (EditText) findViewById(R.id.muc_your_nick);
mFullJid = (TextView) findViewById(R.id.muc_jabberid);
ImageButton imageButton = (ImageButton) findViewById(R.id.muc_edit_nick);
imageButton.setOnClickListener(this.changeNickListener);
ImageButton editNickButton = (ImageButton) findViewById(R.id.muc_edit_nick);
editNickButton.setOnClickListener(this.changeNickListener);
ImageButton editSubjectButton = (ImageButton) findViewById(R.id.muc_edit_subject);
editSubjectButton.setOnClickListener(this.changeSubjectListener);
membersView = (LinearLayout) findViewById(R.id.muc_members);
mMoreDetails = (LinearLayout) findViewById(R.id.muc_more_details);
mMoreDetails.setVisibility(View.GONE);
mSubject = (EditText) findViewById(R.id.muc_subject);
getActionBar().setHomeButtonEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);
@ -110,6 +127,7 @@ public class MucDetailsActivity extends XmppActivity {
}
}
if (this.conversation != null) {
mSubject.setText(conversation.getMucOptions().getSubject());
setTitle(conversation.getName(useSubject));
mFullJid.setText(conversation.getContactJid().split("/")[0]);
mYourNick.setText(conversation.getMucOptions().getNick());