2012-06-25 Santiago Munin <burning1@gmail.com>
* src/pandroid_event_viewer/pandorafms/CreateIncidentActivity.java: Fixed a UI bug and refactorized the API call. * src/pandroid_event_viewer/pandorafms/API.java: Added create incident. * res/layout/main.xml: Little UI changes. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6702 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
00fee81524
commit
8d965c519c
|
@ -1,22 +1,33 @@
|
|||
2012-06-25 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/CreateIncidentActivity.java: Fixed a UI bug and refactorized the API call.
|
||||
* src/pandroid_event_viewer/pandorafms/API.java: Added create incident.
|
||||
* res/layout/main.xml: Little UI changes.
|
||||
|
||||
2012-06-24 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Main.java: Removed getGroups function, now it calls API.getGroups().
|
||||
|
||||
2012-06-24 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Main.java: Added search profiles feature.
|
||||
* res/layout/main.xml: UI changes. Added search profiles feature.
|
||||
* res/values/strings.xml: Added new entries.
|
||||
|
||||
2012-06-23 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Core.java: Fixed a bug in the isOnline() function.
|
||||
* src/pandroid_event_viewer/pandorafms/Options.java: Improved the connection checking functionality.
|
||||
* src/pandroid_event_viewer/pandorafms/API.java: Added getTags().
|
||||
* src/pandroid_event_viewer/pandorafms/Main.java: Now the tags are getted by API.getTags().
|
||||
|
||||
2012-06-21 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Core.java: Added a new method which checks if a website is online.
|
||||
* src/pandroid_event_viewer/pandorafms/Options.java: Fixed a bug. The app didn't check if the url were online before checking the certificate.
|
||||
|
||||
2012-06-21 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/EventList.java: Restored to the previous version.
|
||||
* src/pandroid_event_viewer/pandorafms/Core.java: Added a line which checks if the connection is secure.
|
||||
* src/pandroid_event_viewer/pandorafms/Options.java: Made some changes in certificate checking.
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
<TableLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp" >
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
|
@ -38,20 +39,27 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="5dip"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/profile_label_str" />
|
||||
android:text="@string/profile_label_str"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/profile_combo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<ImageView
|
||||
android:src="@drawable/cross"
|
||||
android:contentDescription="@string/profile_delete"
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete_profile"
|
||||
/>
|
||||
android:contentDescription="@string/profile_delete"
|
||||
android:src="@drawable/cross" />
|
||||
</TableRow>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="#ffffff" />
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
|
|
@ -138,4 +138,22 @@ public class API {
|
|||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new incident in console.
|
||||
* @param context Application context
|
||||
* @param incidentParameters Incident data
|
||||
*/
|
||||
public static void createNewIncident(Context context,
|
||||
String[] incidentParameters) {
|
||||
Log.i(TAG, "Sending new incident");
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
||||
parameters.add(new BasicNameValuePair("op", "set"));
|
||||
parameters.add(new BasicNameValuePair("op2", "new_incident"));
|
||||
parameters.add(new BasicNameValuePair("other_mode",
|
||||
"url_encode_separator_|"));
|
||||
parameters.add(new BasicNameValuePair("other", Core
|
||||
.serializeParams2Api(incidentParameters)));
|
||||
Core.httpGet(context, parameters);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,7 @@
|
|||
package pandroid_event_viewer.pandorafms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -86,14 +81,11 @@ public class CreateIncidentActivity extends Activity {
|
|||
|
||||
/**
|
||||
* Performs the create incident petition.
|
||||
*
|
||||
* @return <b>true</b> if it is created.
|
||||
*/
|
||||
private void sendNewIncident() {
|
||||
private boolean sendNewIncident() {
|
||||
Log.i(TAG, "Sending new incident");
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
||||
parameters.add(new BasicNameValuePair("op", "set"));
|
||||
parameters.add(new BasicNameValuePair("op2", "new_incident"));
|
||||
parameters.add(new BasicNameValuePair("other_mode",
|
||||
"url_encode_separator_|"));
|
||||
String incidentParams[] = new String[6];
|
||||
incidentParams[0] = title.getText().toString();
|
||||
incidentParams[1] = description.getText().toString();
|
||||
|
@ -110,14 +102,10 @@ public class CreateIncidentActivity extends Activity {
|
|||
if (groupCode >= 0) {
|
||||
incidentParams[5] = String.valueOf(groupCode);
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.create_incident_group_error, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
finish();
|
||||
return false;
|
||||
}
|
||||
parameters.add(new BasicNameValuePair("other", Core
|
||||
.serializeParams2Api(incidentParams)));
|
||||
Core.httpGet(getApplicationContext(), parameters);
|
||||
API.createNewIncident(getApplicationContext(), incidentParams);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,20 +114,27 @@ public class CreateIncidentActivity extends Activity {
|
|||
* @author Santiago Munín González
|
||||
*
|
||||
*/
|
||||
private class SetNewIncidentAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
private class SetNewIncidentAsyncTask extends
|
||||
AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
sendNewIncident();
|
||||
return null;
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
return sendNewIncident();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
Toast.makeText(getApplicationContext(), R.string.incident_created,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
protected void onPostExecute(Boolean result) {
|
||||
if (result) {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.incident_created, Toast.LENGTH_SHORT).show();
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.create_incident_group_error,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue