Skip to content

Commit 8edfcc0

Browse files
committed
adt:优化长按用浏览器请求提示
1 parent 7015176 commit 8edfcc0

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

‎APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/gen/apijson/demo/R.java‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,27 @@ public static final class string {
3535
public static final int app_name=0x7f050000;
3636
public static final int app_version=0x7f050001;
3737
public static final int array=0x7f05000a;
38+
public static final int browser_can_only_receive_get_response=0x7f05000f;
3839
public static final int columns=0x7f050008;
3940
public static final int complex=0x7f05000b;
4041
public static final int delete=0x7f050004;
41-
public static final int demo_array=0x7f050015;
42-
public static final int demo_columns=0x7f050013;
43-
public static final int demo_complex=0x7f050016;
44-
public static final int demo_complex_post=0x7f050019;
45-
public static final int demo_delete=0x7f050010;
46-
public static final int demo_post=0x7f05000f;
47-
public static final int demo_put=0x7f050011;
48-
public static final int demo_rely=0x7f050014;
49-
public static final int demo_single=0x7f050012;
50-
public static final int demo_wallet=0x7f050017;
51-
public static final int demo_wallet_with_access=0x7f050018;
42+
public static final int demo_array=0x7f050017;
43+
public static final int demo_columns=0x7f050015;
44+
public static final int demo_complex=0x7f050018;
45+
public static final int demo_complex_post=0x7f05001b;
46+
public static final int demo_delete=0x7f050012;
47+
public static final int demo_post=0x7f050011;
48+
public static final int demo_put=0x7f050013;
49+
public static final int demo_rely=0x7f050016;
50+
public static final int demo_single=0x7f050014;
51+
public static final int demo_wallet=0x7f050019;
52+
public static final int demo_wallet_with_access=0x7f05001a;
5253
public static final int get=0x7f050006;
5354
public static final int post=0x7f050003;
5455
public static final int put=0x7f050005;
5556
public static final int query=0x7f050002;
56-
public static final int query_error=0x7f05000e;
57+
public static final int query_error=0x7f050010;
58+
public static final int received_result=0x7f05000e;
5759
public static final int rely=0x7f050009;
5860
public static final int single=0x7f050007;
5961
}

‎APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/res/values-zh/strings.xml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<string name="complex">复杂结构</string>
1616
<string name="access_error">没有访问权限</string>
1717
<string name="access_permitted">允许使用权限</string>
18+
<string name="received_result">已获得结果!</string>
19+
<string name="browser_can_only_receive_get_response">用浏览器只能获取GET结果</string>
1820
<string name="query_error">可能出现了一些问题,可以按照以下步骤解决:\n\n1.检查网络连接\n\n2.检查url是否为一个可用的IPV4地址\n\n3.长按[ %1$s ]按钮用浏览器发送请求\n\n4.查看目标服务器上的log\n\n5.再试一次</string>
1921

2022
</resources>

‎APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/res/values/strings.xml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<string name="complex">Complex</string>
1616
<string name="access_error">Access Error</string>
1717
<string name="access_permitted">Access Permitted</string>
18+
<string name="received_result">received result!</string>
19+
<string name="browser_can_only_receive_get_response">Browsers can only receive GET responses</string>
1820
<string name="query_error">There may be something wrong,you can follow by the steps:\n\n1.Check your net connection\n\n2.Check the url whether it\'s an available ipv4 address\n\n3.Long click the [ %1$s ] button to open the request by web browser\n\n4.Check logs outputed on the target server\n\n5.Try again</string>
1921
<string name="demo_post">{\n&#160;&#160;&#160;\"tag\":\"post_user\",\n&#160;&#160;&#160;\"User\":{\n&#160;&#160;&#160;&#160;&#160;&#160;\"name\":\"Tommy\",\n&#160;&#160;&#160;&#160;&#160;&#160;\"sex\":0,\n&#160;&#160;&#160;&#160;&#160;&#160;\"phone\":\"1234567890\"\n&#160;&#160;&#160;}\n}</string>
2022
<string name="demo_delete">{\n&#160;&#160;&#160;\"tag\":\"delete_user\",\n&#160;&#160;&#160;\"User\":{\n&#160;&#160;&#160;&#160;&#160;&#160;\"id\":93794\n&#160;&#160;&#160;}\n}</string>

‎APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/ui/QueryActivity.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ private void query() {
166166
/**open request URL String with a browser
167167
*/
168168
public void openWebSite() {
169+
if (type < 10) {
170+
Toast.makeText(context, R.string.browser_can_only_receive_get_response, Toast.LENGTH_LONG).show();
171+
}
169172
setRequest();
170173
String webSite = null;
171174
try {
@@ -276,7 +279,7 @@ public void onHttpResponse(int requestCode, final String resultJson, final Excep
276279
public void run() {
277280
if (isAlive) {
278281
pbQuery.setVisibility(View.GONE);
279-
Toast.makeText(context, "received result!", Toast.LENGTH_SHORT).show();
282+
Toast.makeText(context, R.string.received_result, Toast.LENGTH_SHORT).show();
280283

281284
tvQueryResult.setText(e == null || JSON.isJsonCorrect(resultJson)
282285
? StringUtil.getTrimedString(resultJson) : e.getMessage() + "\n\n\n" + error);

0 commit comments

Comments
 (0)