Skip to content

Commit 8e8bbb9

Browse files
committed
语言适配
1 parent 4ea67fc commit 8e8bbb9

File tree

4 files changed

+9
-171
lines changed

4 files changed

+9
-171
lines changed

app/src/main/java/com/ichtj/basetools/util/FileDialogSelectUtils.java

Lines changed: 0 additions & 165 deletions
This file was deleted.

base_iotutils/src/main/java/com/face_chtj/base_iotutils/FileDialogSelectUtils.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Comparator;
2424
import java.util.List;
2525

26-
2726
public class FileDialogSelectUtils {
2827
public interface FileSelectCallback {
2928
void onFileSelected(List<File> selectedFiles);
@@ -80,15 +79,15 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
8079
});
8180

8281
AlertDialog.Builder builder = new AlertDialog.Builder(context);
83-
builder.setTitle("目录: " + currentDir.getAbsolutePath())
82+
builder.setTitle(context.getString(R.string.iot_directory_title,currentDir.getAbsolutePath()))
8483
.setView(listView)
85-
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
84+
.setPositiveButton(context.getString(R.string.iot_ok), new DialogInterface.OnClickListener() {
8685
@Override
8786
public void onClick(DialogInterface dialog, int which) {
8887
callback.onFileSelected(new ArrayList<>(selectedFiles));
8988
}
9089
})
91-
.setNegativeButton("取消", null);
90+
.setNegativeButton(context.getString(R.string.iot_cancel), null);
9291
dialog = builder.create();
9392
dialog.show();
9493

@@ -131,7 +130,7 @@ public int compare(File f1, File f2) {
131130
}
132131

133132
if (dialog != null) {
134-
dialog.setTitle("目录: " + currentDir.getAbsolutePath());
133+
dialog.setTitle(context.getString(R.string.iot_directory_title,currentDir.getAbsolutePath()));
135134
}
136135
}
137136

@@ -162,7 +161,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
162161

163162
TextView nameView = new TextView(context);
164163
nameView.setTextSize(20);
165-
nameView.setText(file.getName().equals("..") ? "↩ 返回上一级" : file.getName());
164+
nameView.setText(file.getName().equals("..") ? context.getString(R.string.iot_back_directory) : file.getName());
166165
nameView.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1));
167166
layout.addView(nameView);
168167

base_iotutils/src/main/res/values-zh-rCN/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
<string name="iot_ok">确定</string>
44
<string name="iot_cancel">取消</string>
55
<string name="base_input_content">请输入内容</string>
6+
<string name="iot_directory_title">目录: %s</string>
7+
<string name="iot_back_directory">↩ 返回上一级</string>
68
</resources>

base_iotutils/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
<string name="iot_ok">OK</string>
44
<string name="iot_cancel">Cancel</string>
55
<string name="base_input_content">Please enter content</string>
6+
<string name="iot_directory_title">directory: %s</string>
7+
<string name="iot_back_directory">↩ Previous level</string>
68
</resources>

0 commit comments

Comments
 (0)