|
10 | 10 | import android.widget.BaseAdapter; |
11 | 11 | import android.widget.ImageView; |
12 | 12 | import android.widget.TextView; |
| 13 | + |
13 | 14 | import com.developer.filepicker.R; |
14 | 15 | import com.developer.filepicker.controller.NotifyItemChecked; |
15 | 16 | import com.developer.filepicker.model.DialogConfigs; |
|
18 | 19 | import com.developer.filepicker.model.MarkedItemList; |
19 | 20 | import com.developer.filepicker.widget.MaterialCheckbox; |
20 | 21 | import com.developer.filepicker.widget.OnCheckedChangeListener; |
21 | | -import java.text.SimpleDateFormat; |
| 22 | + |
| 23 | +import java.text.DateFormat; |
22 | 24 | import java.util.ArrayList; |
23 | 25 | import java.util.Date; |
24 | | -import java.util.Locale; |
25 | 26 |
|
26 | 27 | /** |
27 | 28 | * @author akshay sunil masram |
@@ -105,14 +106,16 @@ public View getView(final int i, View view, ViewGroup viewGroup) { |
105 | 106 | } |
106 | 107 | holder.type_icon.setContentDescription(item.getFilename()); |
107 | 108 | holder.name.setText(item.getFilename()); |
108 | | - SimpleDateFormat sdate = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()); |
109 | | - SimpleDateFormat stime = new SimpleDateFormat("hh:mm aa", Locale.getDefault()); |
| 109 | + DateFormat dateFormatter = android.text.format.DateFormat.getMediumDateFormat(context); |
| 110 | + DateFormat timeFormatter = android.text.format.DateFormat.getTimeFormat(context); |
| 111 | + //SimpleDateFormat sdate = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault()); |
| 112 | + //SimpleDateFormat stime = new SimpleDateFormat("hh:mm aa", Locale.getDefault()); |
110 | 113 | Date date = new Date(item.getTime()); |
111 | 114 | if(i==0&&item.getFilename().startsWith(context.getString(R.string.label_parent_dir))) { |
112 | 115 | holder.type.setText(R.string.label_parent_directory); |
113 | 116 | } |
114 | 117 | else { |
115 | | - holder.type.setText(context.getString(R.string.last_edit) + sdate.format(date) + ", " + stime.format(date)); |
| 118 | + holder.type.setText(String.format(context.getString(R.string.last_edit), dateFormatter.format(date), timeFormatter.format(date))); |
116 | 119 | } |
117 | 120 | if(holder.fmark.getVisibility()==View.VISIBLE) { |
118 | 121 | if(i==0&&item.getFilename().startsWith(context.getString(R.string.label_parent_dir))) |
|
0 commit comments