mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-30 15:57:11 +00:00
App: Changed list view appearance for the previous course in the course designer. The course is not changeable anymore
This commit is contained in:
1 parent
c77fafce3a
commit
96ca27a3e6
3 files changed
+92
-8
No files matched your search
+6
-6
@@ -26,20 +26,20 @@ public class CourseElementListAdapter extends ArrayAdapter<CourseListDataElement
|
||||
if (convertView == null) {
|
||||
|
||||
LayoutInflater li = (LayoutInflater) (getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE));
|
||||
view = li.inflate(R.layout.welter_draggable_waypoint_item, null);
|
||||
view = li.inflate(R.layout.welter_one_row_three_columns, null);
|
||||
}
|
||||
|
||||
CourseListDataElement courseElement = getItem(position);
|
||||
|
||||
TextView leftMarkText = (TextView) view
|
||||
.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnOne_txtLeftMark);
|
||||
.findViewById(R.id.Welter_Cell_OneRowThreeColumns_columnOne_txtLeftMark);
|
||||
TextView roundingDirectionText = (TextView) view
|
||||
.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_txtRoundingDirection);
|
||||
.findViewById(R.id.Welter_Cell_OneRowThreeColumns_txtRoundingDirection);
|
||||
TextView rightMarkText = (TextView) view
|
||||
.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnThree_txtRightMark);
|
||||
.findViewById(R.id.Welter_Cell_OneRowThreeColumns_columnThree_txtRightMark);
|
||||
|
||||
ImageView leftMarkImage = (ImageView) view.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnOne_imgImage);
|
||||
ImageView rightMarkImage = (ImageView) view.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnThree_imgImage);
|
||||
ImageView leftMarkImage = (ImageView) view.findViewById(R.id.Welter_Cell_OneRowThreeColumns_columnOne_imgImage);
|
||||
ImageView rightMarkImage = (ImageView) view.findViewById(R.id.Welter_Cell_OneRowThreeColumns_columnThree_imgImage);
|
||||
|
||||
leftMarkText.setText(courseElement.getLeftMark().getName());
|
||||
leftMarkImage.setVisibility(View.INVISIBLE);
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.adapters.coursedesign;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.domain.RoundingDirection;
|
||||
import com.sap.sailing.racecommittee.app.utils.MarkImageHelper;
|
||||
|
||||
public class DraggableCourseElementListAdapter extends ArrayAdapter<CourseListDataElement> {
|
||||
|
||||
public DraggableCourseElementListAdapter(Context context, int textViewResourceId, List<CourseListDataElement> objects) {
|
||||
super(context, textViewResourceId, objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View view = convertView;
|
||||
if (convertView == null) {
|
||||
|
||||
LayoutInflater li = (LayoutInflater) (getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE));
|
||||
view = li.inflate(R.layout.welter_draggable_waypoint_item, null);
|
||||
}
|
||||
|
||||
CourseListDataElement courseElement = getItem(position);
|
||||
|
||||
TextView leftMarkText = (TextView) view
|
||||
.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnOne_txtLeftMark);
|
||||
TextView roundingDirectionText = (TextView) view
|
||||
.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_txtRoundingDirection);
|
||||
TextView rightMarkText = (TextView) view
|
||||
.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnThree_txtRightMark);
|
||||
|
||||
ImageView leftMarkImage = (ImageView) view.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnOne_imgImage);
|
||||
ImageView rightMarkImage = (ImageView) view.findViewById(R.id.Welter_Cell_Draggable_Waypoint_Item_columnThree_imgImage);
|
||||
|
||||
leftMarkText.setText(courseElement.getLeftMark().getName());
|
||||
leftMarkImage.setVisibility(View.INVISIBLE);
|
||||
|
||||
if (courseElement.getLeftMark() != null) {
|
||||
int drawable = MarkImageHelper.INSTANCE.resolveMarkImage(courseElement.getLeftMark());
|
||||
leftMarkImage.setImageResource(drawable);
|
||||
leftMarkImage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (courseElement.getRoundingDirection() != null)
|
||||
roundingDirectionText.setText(getDisplayValueForRounding(courseElement.getRoundingDirection()));
|
||||
else
|
||||
roundingDirectionText.setText(R.string.empty);
|
||||
|
||||
if (courseElement.getRightMark() != null) {
|
||||
rightMarkText.setText(courseElement.getRightMark().getName());
|
||||
|
||||
int drawable = MarkImageHelper.INSTANCE.resolveMarkImage(courseElement.getRightMark());
|
||||
rightMarkImage.setImageResource(drawable);
|
||||
rightMarkImage.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
rightMarkText.setText(R.string.empty);
|
||||
rightMarkImage.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
protected String getDisplayValueForRounding(RoundingDirection direction) {
|
||||
if (direction.equals(RoundingDirection.Gate))
|
||||
return "Gate";
|
||||
else if (direction.equals(RoundingDirection.Port))
|
||||
return "P";
|
||||
else if (direction.equals(RoundingDirection.Starboard))
|
||||
return "S";
|
||||
|
||||
return"";
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -38,6 +38,7 @@ import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
import com.sap.sailing.racecommittee.app.domain.RoundingDirection;
|
||||
import com.sap.sailing.racecommittee.app.logging.ExLog;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.coursedesign.CourseElementListAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.coursedesign.DraggableCourseElementListAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.coursedesign.CourseListDataElement;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.coursedesign.MarkGridAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.comparators.NamedComparator;
|
||||
@@ -50,7 +51,7 @@ public class CourseDesignDialogFragment extends RaceDialogFragment {
|
||||
private MarkGridAdapter gridAdapter;
|
||||
private List<CourseListDataElement> courseElements;
|
||||
private List<CourseListDataElement> previousCourseElements;
|
||||
private CourseElementListAdapter courseElementAdapter;
|
||||
private DraggableCourseElementListAdapter courseElementAdapter;
|
||||
private CourseElementListAdapter previousCourseElementAdapter;
|
||||
private DragSortListView newCourseListView;
|
||||
private ListView previousCourseListView;
|
||||
@@ -106,7 +107,7 @@ public class CourseDesignDialogFragment extends RaceDialogFragment {
|
||||
previousCourseElements = new ArrayList<CourseListDataElement>();
|
||||
|
||||
gridAdapter = new MarkGridAdapter(getActivity(), R.layout.welter_one_row_no_image, aMarkList);
|
||||
courseElementAdapter = new CourseElementListAdapter(getActivity(), R.layout.welter_draggable_waypoint_item, courseElements);
|
||||
courseElementAdapter = new DraggableCourseElementListAdapter(getActivity(), R.layout.welter_draggable_waypoint_item, courseElements);
|
||||
previousCourseElementAdapter = new CourseElementListAdapter(getActivity(), R.layout.welter_one_row_three_columns, previousCourseElements);
|
||||
|
||||
loadMarks();
|
||||
|
||||
Reference in new issue
Block a user