Skip to content

Commit adef4e9

Browse files
committed
Add put demo code.
1 parent 230226b commit adef4e9

File tree

7 files changed

+66
-6
lines changed

7 files changed

+66
-6
lines changed

demo/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<classpathentry kind="src" path="auth"/>
55
<classpathentry kind="src" path="beta"/>
66
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
7-
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
88
<classpathentry kind="src" path="src"/>
99
<classpathentry kind="src" path="gen"/>
1010
<classpathentry kind="lib" path="libs/charts4j-1.3.jar"/>

demo/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.androidquery"
4-
android:versionCode="56"
5-
android:versionName="0.30.56">
4+
android:versionCode="57"
5+
android:versionName="0.31.57">
66

77

88
<uses-permission android:name="android.permission.INTERNET" />

demo/src/com/androidquery/test/IntentListActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ public void onCreate(Bundle savedInstanceState) {
5757
forward();
5858
}
5959

60+
AQUtility.debug("on create");
61+
6062

6163
if(isTaskRoot()){
64+
AQUtility.debug("task root start version check");
6265
MarketService ms = new MarketService(this);
6366
ms.level(MarketService.MINOR).checkVersion();
6467
}

demo/src/com/androidquery/test/TestUtility.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ public static void showToast(Context context, String message) {
2424

2525
public static void flurryStart(Context context){
2626

27+
if(true) return;
28+
2729
if(!isTestDevice(context)){
2830
FlurryAgent.onStartSession(context, "D29A1QDKNZEIYFJBKXNR");
2931
}
3032
}
3133

3234
public static void flurryEvent(Context context, String name){
3335

36+
if(true) return;
37+
3438
if(!isTestDevice(context)){
3539
try{
3640
FlurryAgent.onEvent(name, null);
@@ -41,6 +45,9 @@ public static void flurryEvent(Context context, String name){
4145
}
4246

4347
public static void flurryStop(Context context){
48+
49+
if(true) return;
50+
4451
if(!isTestDevice(context)){
4552
FlurryAgent.onEndSession(context);
4653
}

demo/src/com/androidquery/test/async/AjaxLoadingActivity.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.apache.http.HttpEntity;
1414
import org.apache.http.NameValuePair;
1515
import org.apache.http.client.entity.UrlEncodedFormEntity;
16+
import org.apache.http.entity.StringEntity;
1617
import org.apache.http.impl.client.DefaultHttpClient;
1718
import org.apache.http.message.BasicNameValuePair;
1819
import org.json.JSONArray;
@@ -448,8 +449,33 @@ public void async_delete() {
448449

449450
}
450451

451-
public void async_put() {
452+
public void async_put() throws JSONException, UnsupportedEncodingException {
452453

454+
String url = "http://www.androidquery.com/p/doNothing";
455+
456+
JSONObject input = new JSONObject();
457+
input.put("param1", "value1");
458+
input.put("param2", "value2");
459+
460+
StringEntity entity = new StringEntity(input.toString(), "UTF-8");
461+
462+
aq.progress(R.id.progress).put(url, "application/json", entity, JSONObject.class, new AjaxCallback<JSONObject>(){
463+
464+
@Override
465+
public void callback(String url, JSONObject jo, AjaxStatus status){
466+
467+
showResult(jo);
468+
469+
}
470+
471+
});
472+
473+
474+
475+
}
476+
477+
public void putCb(String url, JSONObject jo, AjaxStatus status){
478+
453479
}
454480

455481
public void async_cached(){
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
public void async_put() throws JSONException, UnsupportedEncodingException {
2+
3+
String url = "http://www.androidquery.com/p/doNothing";
4+
5+
JSONObject input = new JSONObject();
6+
input.put("param1", "value1");
7+
input.put("param2", "value2");
8+
9+
StringEntity entity = new StringEntity(input.toString(), "UTF-8");
10+
11+
aq.progress(R.id.progress).put(url, "application/json", entity, JSONObject.class, new AjaxCallback<JSONObject>(){
12+
13+
@Override
14+
public void callback(String url, JSONObject jo, AjaxStatus status){
15+
16+
showResult(jo);
17+
18+
}
19+
20+
});
21+
22+
23+
24+
}

tests/src/com/androidquery/test/AQueryServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public void testMarketSubmit() throws IOException{
6969

7070
//String url = "http://192.168.1.222/api/market?app=com.androidquery&locale=zh-TW&version=0.13.2&code=16";
7171

72-
//String url = "https://androidquery.appspot.com/api/market?app=com.androidquery&locale=en_US&version=0.24.46&code=46&aq=0.23.1&force=true";
73-
String url = "http://192.168.1.165/api/market?app=com.androidquery&locale=en_US&version=0.24.46&code=46&aq=0.23.1&force=true";
72+
String url = "https://androidquery.appspot.com/api/market?app=com.androidquery&locale=en_US&version=0.24.46&code=46&aq=0.23.1&force=true";
73+
//String url = "http://192.168.1.165/api/market?app=com.androidquery&locale=en_US&version=0.24.46&code=46&aq=0.23.1&force=true";
7474

7575

7676
AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>();

0 commit comments

Comments
 (0)