2013-11-07 Miguel de Dios <miguel.dedios@artica.es>
* src/pandroid_event_viewer/pandorafms/EventList.java, src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java, res/layout/create_incident.xml: fixed the popup dialog for the create incident. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9030 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e12e5378ff
commit
e9eb7ed605
|
@ -1,3 +1,10 @@
|
|||
2013-11-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/EventList.java,
|
||||
src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java,
|
||||
res/layout/create_incident.xml: fixed the popup dialog for the
|
||||
create incident.
|
||||
|
||||
2013-11-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* res/drawable/round_event_item_grey.xml,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
android:orientation="vertical" >
|
||||
|
||||
<TableLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
@ -52,7 +51,8 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:inputType="text" />
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="4" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class EventList extends ListActivity {
|
|||
private MyAdapter la;
|
||||
public PandroidEventviewerActivity object;
|
||||
private BroadcastReceiver onBroadcast;
|
||||
private Dialog creatingIncidentDialog;
|
||||
public Dialog creatingIncidentDialog;
|
||||
private Context context = this;
|
||||
private View currentElement;
|
||||
|
||||
|
@ -222,57 +222,54 @@ public class EventList extends ListActivity {
|
|||
@Override
|
||||
protected Dialog onCreateDialog(int id, Bundle args) {
|
||||
switch (id) {
|
||||
case CREATE_INCIDENT_DIALOG:
|
||||
final String group;
|
||||
Dialog dialog = new Dialog(this);
|
||||
dialog.setContentView(R.layout.create_incident);
|
||||
dialog.setTitle(getString(R.string.create_incident));
|
||||
final EditText titleEditText = (EditText) dialog
|
||||
.findViewById(R.id.incident_title);
|
||||
final EditText descriptionEditText = (EditText) dialog
|
||||
.findViewById(R.id.incident_description);
|
||||
String temp = args.getString("title");
|
||||
case CREATE_INCIDENT_DIALOG:
|
||||
final String group;
|
||||
creatingIncidentDialog = new Dialog(this);
|
||||
creatingIncidentDialog.setContentView(R.layout.create_incident);
|
||||
creatingIncidentDialog.setTitle(getString(R.string.create_incident));
|
||||
final EditText titleEditText = (EditText) creatingIncidentDialog
|
||||
.findViewById(R.id.incident_title);
|
||||
final EditText descriptionEditText = (EditText) creatingIncidentDialog
|
||||
.findViewById(R.id.incident_description);
|
||||
String temp = args.getString("title");
|
||||
|
||||
if (temp != null) {
|
||||
titleEditText.setText(temp);
|
||||
}
|
||||
if (temp != null) {
|
||||
titleEditText.setText(temp);
|
||||
}
|
||||
|
||||
temp = args.getString("description");
|
||||
if (temp != null) {
|
||||
descriptionEditText.setText(temp);
|
||||
}
|
||||
temp = args.getString("group");
|
||||
if (temp != null) {
|
||||
group = temp;
|
||||
}
|
||||
else {
|
||||
group = "";
|
||||
}
|
||||
dialog.findViewById(R.id.incident_create_button)
|
||||
.setOnClickListener(new OnClickListener() {
|
||||
temp = args.getString("description");
|
||||
if (temp != null) {
|
||||
descriptionEditText.setText(temp);
|
||||
}
|
||||
temp = args.getString("group");
|
||||
if (temp != null) {
|
||||
group = temp;
|
||||
}
|
||||
else {
|
||||
group = "";
|
||||
}
|
||||
creatingIncidentDialog.findViewById(R.id.incident_create_button)
|
||||
.setOnClickListener(new OnClickListener() {
|
||||
|
||||
public void onClick(View v) {
|
||||
if (titleEditText != null
|
||||
&& titleEditText.length() > 0) {
|
||||
creatingIncidentDialog = ProgressDialog.show(
|
||||
context, "",
|
||||
getString(R.string.creating_incident),
|
||||
true);
|
||||
String title = titleEditText.getText()
|
||||
.toString();
|
||||
String description = descriptionEditText
|
||||
.getText().toString();
|
||||
new SetNewIncidentAsyncTask().execute(title,
|
||||
description, group);
|
||||
public void onClick(View v) {
|
||||
if (titleEditText != null
|
||||
&& titleEditText.length() > 0) {
|
||||
|
||||
String title = titleEditText.getText()
|
||||
.toString();
|
||||
String description = descriptionEditText
|
||||
.getText().toString();
|
||||
new SetNewIncidentAsyncTask().execute(title,
|
||||
description, group);
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.title_empty,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.title_empty,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
return dialog;
|
||||
});
|
||||
return creatingIncidentDialog;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -612,9 +609,9 @@ public class EventList extends ListActivity {
|
|||
Bundle b = new Bundle();
|
||||
b.putString("group", item.group_name);
|
||||
b.putString("title", item.event);
|
||||
b.putString("description",
|
||||
item.description_event);
|
||||
b.putString("description", "");
|
||||
showDialog(CREATE_INCIDENT_DIALOG, b);
|
||||
Log.e("TEST", "TEST");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -796,11 +793,17 @@ public class EventList extends ListActivity {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if (result) {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.incident_created, Toast.LENGTH_SHORT).show();
|
||||
creatingIncidentDialog.dismiss();
|
||||
finish();
|
||||
if (creatingIncidentDialog != null && creatingIncidentDialog.isShowing()) {
|
||||
creatingIncidentDialog.hide();
|
||||
creatingIncidentDialog.dismiss();
|
||||
creatingIncidentDialog = null;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
|
|
|
@ -87,7 +87,8 @@ public class PopupValidationEvent extends Activity {
|
|||
try {
|
||||
return API.validateEvent(getApplicationContext(), idEvent,
|
||||
comment);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
connectionProblem = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -97,7 +98,8 @@ public class PopupValidationEvent extends Activity {
|
|||
protected void onPostExecute(Boolean result) {
|
||||
if (connectionProblem) {
|
||||
Core.showConnectionProblemToast(getApplicationContext(), true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Intent resultIntent = new Intent();
|
||||
resultIntent.putExtra("validated", result);
|
||||
setResult(RESULT_OK, resultIntent);
|
||||
|
|
Loading…
Reference in New Issue