Reduced font size for chart type

This commit is contained in:
Alexey Kulish 2017-03-09 21:32:55 +03:00
parent 724f57859f
commit 57d0bda78d
5 changed files with 68 additions and 54 deletions

View file

@ -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"/>
<ImageView
@ -167,7 +167,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/map_widget_speed"/>
<ImageView

View file

@ -190,6 +190,14 @@
android:focusable="false"
android:gravity="center_vertical"/>
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/toggle_checkbox_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>

View file

@ -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"/>
<ImageView
@ -96,7 +96,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/distance"/>
<ImageView

View file

@ -64,7 +64,7 @@ public class GpxSelectionHelper {
}
File file = new File(selectedGPXFiles.get(0).getGpxFile().path);
return Algorithms.getFileNameWithoutExtension(file);
return Algorithms.getFileNameWithoutExtension(file).replace('_', ' ');
} else if (selectedGPXFiles.size() == 0) {
return null;
} else {

View file

@ -16,6 +16,7 @@ import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.ListPopupWindow;
import android.support.v7.widget.SwitchCompat;
import android.text.SpannableString;
@ -57,6 +58,7 @@ import net.osmand.CallbackWithObject;
import net.osmand.IndexConstants;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.GPXDatabase;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.Elevation;
import net.osmand.plus.GPXUtilities.GPXFile;
@ -78,6 +80,7 @@ import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.dialogs.ConfigureMapMenu.AppearanceListItem;
import net.osmand.plus.dialogs.ConfigureMapMenu.GpxAppearanceAdapter;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.myplaces.AvailableGPXFragment;
import net.osmand.render.RenderingRuleProperty;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms;
@ -418,8 +421,7 @@ public class GpxUiHelper {
final DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(activity);
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final int layout = R.layout.list_item_with_checkbox;
final int switchLayout = R.layout.list_item_with_switch;
final int layout = R.layout.dash_gpx_track_item;
final Map<String, String> gpxAppearanceParams = new HashMap<>();
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(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);
}
}
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,8 +469,13 @@ 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 (dataItem != null && dataItem.getAnalysis() != null) {
} else {
if (info.getLastModified() > 0) {
sb.append(dateFormat.format(info.getLastModified()));
}
@ -485,31 +492,16 @@ public class GpxUiHelper {
sb.append(fileSizeKB).append(" kB");
}
}
}
dv.setText(sb.toString());
/*
final ArrayAdapter<String> 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 {
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() {
@ -518,6 +510,20 @@ public class GpxUiHelper {
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;
}