更新gradle版本

垃圾分类国际化逻辑修改
0515
ZHD 5 years ago
parent 5a1aeae546
commit 43b5ed5358
  1. 4
      app/build.gradle
  2. 10
      app/src/main/java/com/community/pocket/data/model/GarbageSorting.java
  3. 10
      app/src/main/java/com/community/pocket/ui/main/ui/garbage/sorting/GarbageSortingFragment.java
  4. 5
      app/src/main/res/values-en-rUS/strings.xml
  5. 5
      app/src/main/res/values-zh-rCN/strings.xml
  6. 5
      app/src/main/res/values/strings.xml

@ -1,8 +1,8 @@
ext { ext {
//ip地址部分改成ipconfig /all找到的内网地址 //ip地址部分改成ipconfig /all找到的内网地址
API_HOST = 'http://192.168.3.132:8080/' API_HOST = 'http://192.168.101.3:8080/'
//rap2服务端测试地址ip地址部分改成ipconfig /all找到的内网地址 //rap2服务端测试地址ip地址部分改成ipconfig /all找到的内网地址
RAP2_API_HOST = 'http://192.168.3.132:38080/app/mock/1' RAP2_API_HOST = 'http://192.168.101.3:38080/app/mock/1'
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'multi-languages' apply plugin: 'multi-languages'

@ -5,7 +5,7 @@ public class GarbageSorting {
//名称 //名称
private String name; private String name;
//分类 //分类
private String sorting; private Integer category;
//垃圾图片 //垃圾图片
private String image; private String image;
@ -17,12 +17,12 @@ public class GarbageSorting {
this.name = name; this.name = name;
} }
public String getSorting() { public Integer getCategory() {
return sorting; return category;
} }
public void setSorting(String sorting) { public void setCategory(Integer category) {
this.sorting = sorting; this.category = category;
} }
public String getImage() { public String getImage() {

@ -93,7 +93,15 @@ public class GarbageSortingFragment extends BaseFragment {
*/ */
private void initView(GarbageSorting garbageSorting) { private void initView(GarbageSorting garbageSorting) {
name.setText(garbageSorting.getName()); name.setText(garbageSorting.getName());
sorting.setText(garbageSorting.getSorting()); int resId=R.string.unknow_error;
switch (garbageSorting.getCategory()){
case 1:resId=R.string.garbage_category_1;break;
case 2:resId=R.string.garbage_category_2;break;
case 4:resId=R.string.garbage_category_4;break;
case 8:resId=R.string.garbage_category_8;break;
case 16:resId=R.string.garbage_category_16;break;
}
sorting.setText(resId);
} }
/** /**

@ -178,4 +178,9 @@
<string name="check_server_ok">connect server ok</string> <string name="check_server_ok">connect server ok</string>
<string name="check_server_fail">connect server:%1s fail</string> <string name="check_server_fail">connect server:%1s fail</string>
<string name="error_api_host">api error%1s</string> <string name="error_api_host">api error%1s</string>
<string name="garbage_category_1">recoverable</string>
<string name="garbage_category_2">hazardous waste</string>
<string name="garbage_category_4">wet garbage</string>
<string name="garbage_category_8">dry refuse</string>
<string name="garbage_category_16">Bulky Waste</string>
</resources> </resources>

@ -178,4 +178,9 @@
<string name="check_server_ok">连接服务端成功</string> <string name="check_server_ok">连接服务端成功</string>
<string name="check_server_fail">调试信息:无法连接到服务端:%1s</string> <string name="check_server_fail">调试信息:无法连接到服务端:%1s</string>
<string name="error_api_host">非法服务端配置:%1s</string> <string name="error_api_host">非法服务端配置:%1s</string>
<string name="garbage_category_1">可回收垃圾</string>
<string name="garbage_category_2">有害垃圾</string>
<string name="garbage_category_4">湿垃圾</string>
<string name="garbage_category_8">干垃圾</string>
<string name="garbage_category_16">大件垃圾</string>
</resources> </resources>

@ -179,6 +179,11 @@
<string name="check_server_ok">connect server ok</string> <string name="check_server_ok">connect server ok</string>
<string name="check_server_fail">connect server:%1s fail</string> <string name="check_server_fail">connect server:%1s fail</string>
<string name="error_api_host">api error%1s</string> <string name="error_api_host">api error%1s</string>
<string name="garbage_category_1">recoverable</string>
<string name="garbage_category_2">hazardous waste</string>
<string name="garbage_category_4">wet garbage</string>
<string name="garbage_category_8">dry refuse</string>
<string name="garbage_category_16">Bulky Waste</string>
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save