mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
RCApp: course icon depending on douse name (Ix = up/down; Ox (others) = triangle)
This commit is contained in:
1 parent
96cd9b315b
commit
083a1d127c
6 files changed
+115
-33
No files matched your search
@@ -178,7 +178,7 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="@dimen/textSize_22"
|
||||
android:textColor="?white"
|
||||
android:drawableTop="@drawable/course_updown_64dp"
|
||||
tools:drawableTop="@drawable/course_updown_64dp"
|
||||
tools:text="012" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@@ -46,7 +47,8 @@
|
||||
android:layout_toStartOf="@id/start_time_icon"
|
||||
android:gravity="end"
|
||||
android:textColor="?white"
|
||||
android:textSize="@dimen/textSize_22"/>
|
||||
android:textSize="@dimen/textSize_22"
|
||||
tools:text="14:00" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
@@ -98,7 +100,8 @@
|
||||
android:layout_toStartOf="@id/start_procedure_icon"
|
||||
android:gravity="end"
|
||||
android:textColor="?white"
|
||||
android:textSize="@dimen/textSize_22" />
|
||||
android:textSize="@dimen/textSize_22"
|
||||
tools:text="Fix Line Start (RRS26)" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
@@ -145,7 +148,8 @@
|
||||
android:layout_margin="@dimen/default_margin_half"
|
||||
android:layout_toLeftOf="@+id/start_mode_value"
|
||||
android:layout_toStartOf="@+id/start_mode_value"
|
||||
android:focusableInTouchMode="false" />
|
||||
android:focusableInTouchMode="false"
|
||||
tools:src="@drawable/flag_papa_48dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_mode_value"
|
||||
@@ -159,7 +163,8 @@
|
||||
android:gravity="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="?white"
|
||||
android:textSize="@dimen/textSize_22"/>
|
||||
android:textSize="@dimen/textSize_22"
|
||||
tools:text="Papa" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
@@ -199,12 +204,14 @@
|
||||
android:src="@drawable/ic_chevron_right_grey600_24dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start_course_symbol"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="@dimen/default_margin_half"
|
||||
android:layout_toLeftOf="@+id/start_course_value"
|
||||
android:layout_toStartOf="@+id/start_course_value" />
|
||||
android:layout_toStartOf="@+id/start_course_value"
|
||||
tools:src="@drawable/course_triangle_48dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/start_course_value"
|
||||
@@ -217,9 +224,9 @@
|
||||
android:layout_toStartOf="@+id/start_course_icon"
|
||||
android:gravity="end"
|
||||
android:singleLine="true"
|
||||
android:text="Triangle"
|
||||
android:textColor="?white"
|
||||
android:textSize="@dimen/textSize_22"/>
|
||||
android:textSize="@dimen/textSize_22"
|
||||
tools:text="O3" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
||||
+6
-1
@@ -35,8 +35,11 @@ import com.sap.sailing.racecommittee.app.services.RaceStateService;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.racelist.RaceListDataType;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.racelist.RaceListDataTypeHeader;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.racelist.RaceListDataTypeRace;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.*;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceInfoFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceListFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.RaceListFragment.RaceListCallbacks;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.WelcomeFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.panels.TimePanelFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.RaceFlagViewerFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.RaceInfoListener;
|
||||
@@ -592,9 +595,11 @@ public class RacingActivity extends SessionActivity implements RaceInfoListener,
|
||||
if (AppConstants.INTENT_ACTION_TIME_HIDE.equals(action)) {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (AppConstants.INTENT_ACTION_TIME_SHOW.equals(action)) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (AppConstants.INTENT_ACTION_SHOW_MAIN_CONTENT.equals(action)) {
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable(AppConstants.RACE_ID_KEY, mSelectedRace.getId());
|
||||
|
||||
+19
-6
@@ -1,7 +1,10 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.adapters;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -11,14 +14,10 @@ import android.widget.TextView;
|
||||
import com.sap.sailing.android.shared.util.ViewHolder;
|
||||
import com.sap.sailing.domain.common.impl.NaturalComparator;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.CourseFragmentName;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mars3142 on 04.03.15.
|
||||
*/
|
||||
public class CourseNameAdapter extends BaseAdapter implements View.OnClickListener {
|
||||
|
||||
private Context mContext;
|
||||
@@ -48,6 +47,7 @@ public class CourseNameAdapter extends BaseAdapter implements View.OnClickListen
|
||||
return position;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
@@ -55,9 +55,10 @@ public class CourseNameAdapter extends BaseAdapter implements View.OnClickListen
|
||||
convertView = inflater.inflate(R.layout.flag_list_item, parent, false);
|
||||
}
|
||||
|
||||
String courseName = getItem(position);
|
||||
TextView firstLine = ViewHolder.get(convertView, R.id.first_line);
|
||||
if (firstLine != null) {
|
||||
firstLine.setText(getItem(position));
|
||||
firstLine.setText(courseName);
|
||||
}
|
||||
|
||||
TextView secondLine = ViewHolder.get(convertView, R.id.second_line);
|
||||
@@ -67,7 +68,19 @@ public class CourseNameAdapter extends BaseAdapter implements View.OnClickListen
|
||||
|
||||
ImageView flag = ViewHolder.get(convertView, R.id.flag);
|
||||
if (flag != null) {
|
||||
flag.setImageDrawable(mContext.getResources().getDrawable(R.drawable.course_updown_48dp));
|
||||
int resId;
|
||||
if (courseName.toLowerCase().startsWith("i")) {
|
||||
resId = R.drawable.course_updown_48dp;
|
||||
} else {
|
||||
resId = R.drawable.course_triangle_48dp;
|
||||
}
|
||||
Drawable flagDrawable;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
flagDrawable = mContext.getResources().getDrawable(resId, null);
|
||||
} else {
|
||||
flagDrawable = mContext.getResources().getDrawable(resId);
|
||||
}
|
||||
flag.setImageDrawable(flagDrawable);
|
||||
}
|
||||
|
||||
convertView.setOnClickListener(this);
|
||||
|
||||
+31
-3
@@ -1,12 +1,16 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.panels;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -22,7 +26,10 @@ import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.rrs26.RRS26
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.*;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.CourseFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.StartModeFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.StartProcedureFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.raceinfo.WindFragment;
|
||||
import com.sap.sailing.racecommittee.app.ui.utils.FlagsResources;
|
||||
|
||||
public class SetupPanelFragment extends BasePanelFragment {
|
||||
@@ -126,9 +133,30 @@ public class SetupPanelFragment extends BasePanelFragment {
|
||||
LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mReceiver);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void refreshPanel() {
|
||||
if (mCourseValue != null && getRaceState().getCourseDesign() != null) {
|
||||
mCourseValue.setText(getRaceState().getCourseDesign().getName());
|
||||
if (mCourseValue != null) {
|
||||
mCourseValue.setText(null);
|
||||
mCourseValue.setCompoundDrawables(null, null, null, null);
|
||||
if (getRaceState().getCourseDesign() != null) {
|
||||
String courseName = getRaceState().getCourseDesign().getName();
|
||||
mCourseValue.setText(courseName);
|
||||
Drawable drawable = null;
|
||||
if (!TextUtils.isEmpty(courseName)) {
|
||||
int resId;
|
||||
if (courseName.toLowerCase().startsWith("i")) {
|
||||
resId = R.drawable.course_updown_64dp;
|
||||
} else {
|
||||
resId = R.drawable.course_triangle_64dp;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
drawable = getResources().getDrawable(resId, null);
|
||||
} else {
|
||||
drawable = getResources().getDrawable(resId);
|
||||
}
|
||||
}
|
||||
mCourseValue.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (mStartProcedureValue != null && getRaceState().getTypedRacingProcedure() != null) {
|
||||
|
||||
+44
-15
@@ -1,11 +1,17 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.*;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.sap.sailing.android.shared.util.ViewHolder;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.rrs26.RRS26RacingProcedure;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
@@ -37,6 +43,7 @@ public class MainScheduleFragment extends RaceFragment implements View.OnClickLi
|
||||
private TextView mStartModeValue;
|
||||
private ImageView mStartModeFlag;
|
||||
private TextView mCourseValue;
|
||||
private ImageView mCourseSymbol;
|
||||
|
||||
public static MainScheduleFragment newInstance() {
|
||||
MainScheduleFragment fragment = new MainScheduleFragment();
|
||||
@@ -47,46 +54,48 @@ public class MainScheduleFragment extends RaceFragment implements View.OnClickLi
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View layout = inflater.inflate(R.layout.race_schedule, container, false);
|
||||
|
||||
View startTime = layout.findViewById(R.id.start_time);
|
||||
View startTime = ViewHolder.get(layout, R.id.start_time);
|
||||
if (startTime != null) {
|
||||
startTime.setOnClickListener(this);
|
||||
}
|
||||
mStartTime = (TextView) layout.findViewById(R.id.start_time_value);
|
||||
mStartTime = ViewHolder.get(layout, R.id.start_time_value);
|
||||
|
||||
View startProcedure = layout.findViewById(R.id.start_procedure);
|
||||
View startProcedure = ViewHolder.get(layout, R.id.start_procedure);
|
||||
if (startProcedure != null) {
|
||||
startProcedure.setOnClickListener(this);
|
||||
}
|
||||
|
||||
mStartProcedureValue = (TextView) layout.findViewById(R.id.start_procedure_value);
|
||||
mStartProcedureValue = ViewHolder.get(layout, R.id.start_procedure_value);
|
||||
|
||||
mStartMode = layout.findViewById(R.id.start_mode);
|
||||
mStartMode = ViewHolder.get(layout, R.id.start_mode);
|
||||
if (mStartMode != null) {
|
||||
mStartMode.setOnClickListener(this);
|
||||
}
|
||||
mStartModeValue = (TextView) layout.findViewById(R.id.start_mode_value);
|
||||
mStartModeFlag = (ImageView) layout.findViewById(R.id.start_mode_flag);
|
||||
mStartModeValue = ViewHolder.get(layout, R.id.start_mode_value);
|
||||
mStartModeFlag = ViewHolder.get(layout, R.id.start_mode_flag);
|
||||
|
||||
View course = layout.findViewById(R.id.start_course);
|
||||
View course = ViewHolder.get(layout, R.id.start_course);
|
||||
if (course != null) {
|
||||
course.setOnClickListener(this);
|
||||
}
|
||||
mCourseValue = (TextView) layout.findViewById(R.id.start_course_value);
|
||||
mCourseSymbol = ViewHolder.get(layout, R.id.start_course_symbol);
|
||||
mCourseValue = ViewHolder.get(layout, R.id.start_course_value);
|
||||
|
||||
View start = layout.findViewById(R.id.start_race);
|
||||
View start = ViewHolder.get(layout, R.id.start_race);
|
||||
if (start != null) {
|
||||
start.setOnClickListener(this);
|
||||
}
|
||||
|
||||
View wind = layout.findViewById(R.id.wind);
|
||||
View wind = ViewHolder.get(layout, R.id.wind);
|
||||
if (wind != null) {
|
||||
wind.setOnClickListener(this);
|
||||
}
|
||||
mWindValue = (TextView) layout.findViewById(R.id.wind_value);
|
||||
mWindValue = ViewHolder.get(layout, R.id.wind_value);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -124,11 +133,31 @@ public class MainScheduleFragment extends RaceFragment implements View.OnClickLi
|
||||
mStartMode.setVisibility(View.GONE);
|
||||
}
|
||||
if (mStartProcedureValue != null) {
|
||||
mStartProcedureValue.setText(getRaceState().getRacingProcedure().getType()==null?"":getRaceState().getRacingProcedure().getType().toString());
|
||||
if (getRaceState().getRacingProcedure().getType() != null) {
|
||||
mStartProcedureValue.setText(getRaceState().getRacingProcedure().getType().toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (mCourseValue != null) {
|
||||
mCourseValue.setText(getRaceState().getCourseDesign()==null?"":getRaceState().getCourseDesign().getName());
|
||||
if (getRaceState().getCourseDesign() != null) {
|
||||
String courseName = getRaceState().getCourseDesign().getName();
|
||||
mCourseValue.setText(courseName);
|
||||
if (mCourseSymbol != null && !TextUtils.isEmpty(courseName)) {
|
||||
int resId;
|
||||
if (courseName.toLowerCase().startsWith("i")) {
|
||||
resId = R.drawable.course_updown_48dp;
|
||||
} else {
|
||||
resId = R.drawable.course_triangle_48dp;
|
||||
}
|
||||
Drawable drawable;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
drawable = getResources().getDrawable(resId, null);
|
||||
} else {
|
||||
drawable = getResources().getDrawable(resId);
|
||||
}
|
||||
mCourseSymbol.setImageDrawable(drawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user