From 57d0bda78de8916edc8f484d32202a3176234360 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Thu, 9 Mar 2017 21:32:55 +0300 Subject: [PATCH] Reduced font size for chart type --- OsmAnd/res/layout-land/track_details.xml | 4 +- OsmAnd/res/layout/dash_gpx_track_item.xml | 8 ++ OsmAnd/res/layout/track_details.xml | 4 +- .../net/osmand/plus/GpxSelectionHelper.java | 2 +- .../net/osmand/plus/helpers/GpxUiHelper.java | 104 +++++++++--------- 5 files changed, 68 insertions(+), 54 deletions(-) diff --git a/OsmAnd/res/layout-land/track_details.xml b/OsmAnd/res/layout-land/track_details.xml index 545f694f2a..81cc4c9437 100644 --- a/OsmAnd/res/layout-land/track_details.xml +++ b/OsmAnd/res/layout-land/track_details.xml @@ -123,7 +123,7 @@ android:layout_weight="1" android:layout_marginRight="@dimen/list_content_padding" android:textColor="?android:attr/textColorPrimary" - android:textSize="@dimen/default_list_text_size" + android:textSize="@dimen/default_desc_text_size" tools:text="@string/altitude"/> + + diff --git a/OsmAnd/res/layout/track_details.xml b/OsmAnd/res/layout/track_details.xml index 496f54a90c..9ad30ce0e1 100644 --- a/OsmAnd/res/layout/track_details.xml +++ b/OsmAnd/res/layout/track_details.xml @@ -52,7 +52,7 @@ android:layout_weight="1" android:layout_marginRight="@dimen/list_content_padding" android:textColor="?android:attr/textColorPrimary" - android:textSize="@dimen/default_list_text_size" + android:textSize="@dimen/default_desc_text_size" tools:text="@string/altitude"/> gpxAppearanceParams = new HashMap<>(); final ArrayAdapter listAdapter = new ArrayAdapter(activity, layout, R.id.title, @@ -439,14 +441,14 @@ public class GpxUiHelper { public View getView(final int position, View convertView, ViewGroup parent) { // User super class to create the View View v = convertView; + boolean checkLayout = getItemViewType(position) == 0; if (v == null) { - if (getItemViewType(position) == 0) { - v = activity.getLayoutInflater().inflate(layout, null); - } else { - v = activity.getLayoutInflater().inflate(switchLayout, null); - } + v = activity.getLayoutInflater().inflate(layout, null); } + GPXInfo info = list.get(position); + AvailableGPXFragment.udpateGpxInfoView(v, info, app, false); + TextView tv = (TextView) v.findViewById(R.id.title); TextView dv = (TextView) v.findViewById(R.id.description); final ContextMenuItem item = adapter.getItem(position); @@ -467,57 +469,61 @@ public class GpxUiHelper { } tv.setText(item.getTitle().replace("/", " • ")); + GPXInfo info = list.get(position); + GPXDatabase.GpxDataItem dataItem = app.getGpxDatabase().getItem(new File(info.fileName)); StringBuilder sb = new StringBuilder(); - if (info.getLastModified() > 0) { - sb.append(dateFormat.format(info.getLastModified())); - } - if (info.getFileSize() >= 0) { - if (sb.length() > 0) { - sb.append(" • "); + if (dataItem != null && dataItem.getAnalysis() != null) { + + } else { + if (info.getLastModified() > 0) { + sb.append(dateFormat.format(info.getLastModified())); } - long fileSizeKB = info.getFileSize() / 1000; - if (info.getFileSize() < 5000) { - sb.append(info.getFileSize()).append(" B"); - } else if (fileSizeKB > 100) { - sb.append(formatMb.format(new Object[]{(float) fileSizeKB / (1 << 10)})); - } else { - sb.append(fileSizeKB).append(" kB"); + if (info.getFileSize() >= 0) { + if (sb.length() > 0) { + sb.append(" • "); + } + long fileSizeKB = info.getFileSize() / 1000; + if (info.getFileSize() < 5000) { + sb.append(info.getFileSize()).append(" B"); + } else if (fileSizeKB > 100) { + sb.append(formatMb.format(new Object[]{(float) fileSizeKB / (1 << 10)})); + } else { + sb.append(fileSizeKB).append(" kB"); + } } } dv.setText(sb.toString()); - /* - final ArrayAdapter arrayAdapter = this; - iconView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - int nline = item.getTitle().indexOf('\n'); - if (nline == -1) { - String fileName = list.get(position).getFileName(); - setDescripionInDialog(arrayAdapter, adapter, activity, dir, fileName, position); - } else { - item.setTitle(item.getTitle().substring(0, nline)); - arrayAdapter.notifyDataSetInvalidated(); - } - } - - }); - */ - - - final CheckBox ch = ((CheckBox) v.findViewById(R.id.toggle_item)); if (item.getSelected() == null) { - ch.setVisibility(View.INVISIBLE); + v.findViewById(R.id.check_item).setVisibility(View.GONE); } else { - ch.setOnCheckedChangeListener(null); - ch.setChecked(item.getSelected()); - ch.setOnCheckedChangeListener(new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - item.setSelected(isChecked); - } - }); + if (checkLayout) { + final AppCompatCheckBox ch = ((AppCompatCheckBox) v.findViewById(R.id.toggle_checkbox_item)); + ch.setVisibility(View.VISIBLE); + v.findViewById(R.id.toggle_item).setVisibility(View.GONE); + ch.setOnCheckedChangeListener(null); + ch.setChecked(item.getSelected()); + ch.setOnCheckedChangeListener(new OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + item.setSelected(isChecked); + } + }); + } else { + final SwitchCompat ch = ((SwitchCompat) v.findViewById(R.id.toggle_item)); + ch.setVisibility(View.VISIBLE); + v.findViewById(R.id.toggle_checkbox_item).setVisibility(View.GONE); + ch.setOnCheckedChangeListener(null); + ch.setChecked(item.getSelected()); + ch.setOnCheckedChangeListener(new OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + item.setSelected(isChecked); + } + }); + } + v.findViewById(R.id.check_item).setVisibility(View.VISIBLE); } return v; }