4
4
import android .content .Context ;
5
5
import android .content .DialogInterface ;
6
6
import android .util .DisplayMetrics ;
7
+ import android .util .TypedValue ;
7
8
import android .view .Gravity ;
8
9
import android .view .View ;
9
10
import android .view .ViewGroup ;
@@ -35,6 +36,7 @@ public interface FileSelectCallback {
35
36
private final List <File > selectedFiles = new ArrayList <>();
36
37
private AlertDialog dialog ;
37
38
private FileListAdapter adapter ;
39
+ private int itemTvSize =20 ;
38
40
39
41
private float widthRatio = 1f ;
40
42
private float heightRatio = 1f ;
@@ -45,6 +47,13 @@ public FileDialogSelectUtils(Context context, File startDir, FileSelectCallback
45
47
this .callback = callback ;
46
48
}
47
49
50
+ public FileDialogSelectUtils setSizeRatio (float widthRatio , float heightRatio ,int itemTvSize ) {
51
+ this .widthRatio = widthRatio ;
52
+ this .heightRatio = heightRatio ;
53
+ this .itemTvSize = itemTvSize ;
54
+ return this ;
55
+ }
56
+
48
57
public FileDialogSelectUtils setSizeRatio (float widthRatio , float heightRatio ) {
49
58
this .widthRatio = widthRatio ;
50
59
this .heightRatio = heightRatio ;
@@ -160,7 +169,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
160
169
layout .setGravity (Gravity .CENTER_VERTICAL );
161
170
162
171
TextView nameView = new TextView (context );
163
- nameView .setTextSize (20 );
172
+ nameView .setTextSize (TypedValue . COMPLEX_UNIT_SP , itemTvSize );
164
173
nameView .setText (file .getName ().equals (".." ) ? context .getString (R .string .iot_back_directory ) : file .getName ());
165
174
nameView .setLayoutParams (new LinearLayout .LayoutParams (0 , ViewGroup .LayoutParams .WRAP_CONTENT , 1 ));
166
175
layout .addView (nameView );
0 commit comments