2012-06-24 Santiago Munin <burning1@gmail.com>
* src/pandroid_event_viewer/pandorafms/Main.java: Removed getGroups function, now it calls API.getGroups(). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6685 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f792c71e78
commit
4ddac5736a
|
@ -1,3 +1,6 @@
|
|||
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.
|
||||
|
|
|
@ -24,9 +24,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.TabActivity;
|
||||
|
@ -288,41 +285,6 @@ public class Main extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get groups through an api call.
|
||||
*
|
||||
* @return A list of groups.
|
||||
*/
|
||||
private List<String> getGroups() {
|
||||
ArrayList<String> array = new ArrayList<String>();
|
||||
|
||||
try {
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
||||
parameters.add(new BasicNameValuePair("op", "get"));
|
||||
parameters.add(new BasicNameValuePair("op2", "groups"));
|
||||
parameters.add(new BasicNameValuePair("other_mode",
|
||||
"url_encode_separator_|"));
|
||||
parameters.add(new BasicNameValuePair("return_type", "csv"));
|
||||
parameters.add(new BasicNameValuePair("other", ";"));
|
||||
|
||||
String return_api = Core.httpGet(getApplicationContext(),
|
||||
parameters);
|
||||
String[] lines = return_api.split("\n");
|
||||
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
String[] groups = lines[i].split(";", 21);
|
||||
|
||||
this.pandoraGroups.put(Integer.valueOf(groups[0]), groups[1]);
|
||||
|
||||
array.add(groups[1]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG + ": getting groups", e.getMessage());
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Async task which get groups.
|
||||
*
|
||||
|
@ -334,7 +296,8 @@ public class Main extends Activity {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
list = getGroups();
|
||||
list = new ArrayList<String>();
|
||||
list.addAll(API.getGroups(getApplicationContext()).values());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue