Changed messages module. Now messages are writing in a new layout, not
in a new dialog.
This commit is contained in:
parent
7f3ef62bec
commit
9c1f0c9204
@ -159,8 +159,8 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="es.ugr.swad.swadroid.modules.Messages"
|
||||
android:label="@string/messagesModuleLabel"
|
||||
android:theme="@style/Theme.AppCompat.Light.Translucent" >
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/messagesModuleLabel">
|
||||
</activity>
|
||||
<activity
|
||||
android:name="es.ugr.swad.swadroid.modules.notifications.NotificationItem"
|
||||
|
@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout1"
|
||||
@ -18,14 +22,6 @@
|
||||
android:textColor="@color/foreground1" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/addRcv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:src="@android:drawable/ic_input_add" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout1"
|
||||
android:layout_width="wrap_content"
|
||||
@ -37,7 +33,7 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/message_subject_text"
|
||||
android:layout_width="306dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/message_subject_title"
|
||||
android:textColor="@color/foreground1" />
|
||||
@ -50,4 +46,30 @@
|
||||
android:textColor="@color/foreground1" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/addRcv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/relativeLayout1"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@android:drawable/ic_input_add" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancelMsg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="40dp"
|
||||
android:text="@string/cancelMsg" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/sendMsg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:text="@string/sendMsg" />
|
||||
|
||||
</RelativeLayout>
|
15
SWADroid/res/layout/users_listview.xml
Normal file
15
SWADroid/res/layout/users_listview.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/users_listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/background" >
|
||||
|
||||
</ListView>
|
||||
|
||||
</LinearLayout>
|
@ -141,7 +141,7 @@
|
||||
<string name="sendMsg">Send</string>
|
||||
|
||||
|
||||
<string name="addRcv">Agregar Destinatario</string>
|
||||
<string name="addRcv">Add Recievers</string>
|
||||
|
||||
|
||||
<string name="cleanDatabaseMsg">The database has been cleaned</string>
|
||||
|
@ -18,29 +18,38 @@
|
||||
*/
|
||||
package es.ugr.swad.swadroid.modules;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.DialogInterface.OnKeyListener;
|
||||
import android.content.DialogInterface.OnShowListener;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
|
||||
import es.ugr.swad.swadroid.Constants;
|
||||
import es.ugr.swad.swadroid.R;
|
||||
import es.ugr.swad.swadroid.gui.DialogFactory;
|
||||
import es.ugr.swad.swadroid.model.User;
|
||||
import es.ugr.swad.swadroid.webservices.SOAPClient;
|
||||
import es.ugr.swad.swadroid.modules.rollcall.students.*;
|
||||
|
||||
import org.ksoap2.serialization.SoapObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
@ -74,22 +83,20 @@ public class Messages extends Module {
|
||||
* Message's body
|
||||
*/
|
||||
private String body;
|
||||
|
||||
|
||||
private Dialog mMessageDialog;
|
||||
|
||||
private Button add;
|
||||
|
||||
/*
|
||||
private final View.OnClickListener positiveClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
/*if(isDebuggable) {
|
||||
Log.d(TAG, "notificationCode = " + Long.toString(notificationCode));
|
||||
}*/
|
||||
}
|
||||
|
||||
try {
|
||||
/*if(isDebuggable) {
|
||||
Log.i(TAG, "selectedCourseCode = " + Long.toString(courseCode));
|
||||
}*/
|
||||
}
|
||||
|
||||
runConnection();
|
||||
} catch (Exception e) {
|
||||
@ -129,7 +136,7 @@ public class Messages extends Module {
|
||||
receiversText.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see es.ugr.swad.swadroid.modules.Module#onCreate(android.os.Bundle)
|
||||
@ -140,50 +147,71 @@ public class Messages extends Module {
|
||||
|
||||
eventCode = getIntent().getLongExtra("eventCode", 0);
|
||||
setContentView(R.layout.messages_screen);
|
||||
|
||||
/*mMessageDialog = DialogFactory.createPositiveNegativeDialog(this,
|
||||
R.layout.messages_screen,
|
||||
R.string.messagesModuleLabel,
|
||||
-1,
|
||||
R.string.sendMsg,
|
||||
R.string.cancelMsg,
|
||||
// positiveClickListener,
|
||||
null,
|
||||
negativeClickListener,
|
||||
cancelClickListener);
|
||||
|
||||
mMessageDialog.setOnShowListener(showListener);
|
||||
mMessageDialog.show();
|
||||
|
||||
setTitle(R.string.messagesModuleLabel);
|
||||
getSupportActionBar().setIcon(R.drawable.msg);
|
||||
|
||||
if (savedInstanceState != null)
|
||||
writeData();
|
||||
|
||||
setMETHOD_NAME("sendMessage");
|
||||
getSupportActionBar().hide();*/
|
||||
//getSupportActionBar().hide();
|
||||
|
||||
add = (Button) findViewById(R.id.addRcv);
|
||||
ImageButton add = (ImageButton) findViewById(R.id.addRcv);
|
||||
|
||||
add.setOnClickListener(new OnClickListener() {
|
||||
add.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
public void onClick(View v) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Toast.makeText(getBaseContext(), "Boton para añadir usuarios", Toast.LENGTH_SHORT).show();
|
||||
/*setContentView(R.layout.users_listview);
|
||||
setTitle("Prueba");
|
||||
getSupportActionBar().setIcon(R.drawable.info);*/
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button send = (Button) findViewById(R.id.sendMsg);
|
||||
send.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
public void onClick(View view) {
|
||||
/*if(isDebuggable) {
|
||||
Log.d(TAG, "notificationCode = " + Long.toString(notificationCode));
|
||||
}*/
|
||||
|
||||
try {
|
||||
/*if(isDebuggable) {
|
||||
Log.i(TAG, "selectedCourseCode = " + Long.toString(courseCode));
|
||||
}*/
|
||||
|
||||
runConnection();
|
||||
} catch (Exception e) {
|
||||
String errorMsg = getString(R.string.errorServerResponseMsg);
|
||||
error(TAG, errorMsg, e, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Button cancel = (Button) findViewById(R.id.cancelMsg);
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
public void onClick(View v) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads user input from Dialog
|
||||
*/
|
||||
private void readData() {
|
||||
EditText rcv = (EditText) mMessageDialog.findViewById(R.id.message_receivers_text);
|
||||
EditText rcv = (EditText) /*mMessageDialog.*/findViewById(R.id.message_receivers_text);
|
||||
receivers = rcv.getText().toString();
|
||||
|
||||
EditText subj = (EditText) mMessageDialog.findViewById(R.id.message_subject_text);
|
||||
EditText subj = (EditText) /*mMessageDialog.*/findViewById(R.id.message_subject_text);
|
||||
subject = subj.getText().toString();
|
||||
|
||||
EditText bd = (EditText) mMessageDialog.findViewById(R.id.message_body_text);
|
||||
EditText bd = (EditText) /*mMessageDialog.*/findViewById(R.id.message_body_text);
|
||||
body = bd.getText().toString();
|
||||
|
||||
}
|
||||
@ -192,13 +220,13 @@ public class Messages extends Module {
|
||||
* Writes user input to Dialog
|
||||
*/
|
||||
private void writeData() {
|
||||
EditText rcv = (EditText) mMessageDialog.findViewById(R.id.message_receivers_text);
|
||||
EditText rcv = (EditText) /*mMessageDialog.*/findViewById(R.id.message_receivers_text);
|
||||
rcv.setText(receivers);
|
||||
|
||||
EditText subj = (EditText) mMessageDialog.findViewById(R.id.message_subject_text);
|
||||
EditText subj = (EditText) /*mMessageDialog.*/findViewById(R.id.message_subject_text);
|
||||
subj.setText(subject);
|
||||
|
||||
EditText bd = (EditText) mMessageDialog.findViewById(R.id.message_body_text);
|
||||
EditText bd = (EditText) /*mMessageDialog.*/findViewById(R.id.message_body_text);
|
||||
bd.setText(body);
|
||||
}
|
||||
|
||||
@ -278,7 +306,7 @@ public class Messages extends Module {
|
||||
Toast.makeText(this, messageSended, Toast.LENGTH_LONG).show();
|
||||
Log.i(TAG, messageSended);
|
||||
|
||||
mMessageDialog.dismiss();
|
||||
//mMessageDialog.dismiss();
|
||||
|
||||
finish();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user