mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
Merge branch 'ubilabs--rcapp--develop' into ubilabs--rcapp--bug-3624
This commit is contained in:
commit
cb4ae30b59
1220 files changed
+166233
-9477
No files matched your search
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="tests-jvm/src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.json.simple"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="lib" path="/com.sap.sailing.targetplatform.base/plugins/target-test/mockito-core-1.10.14.jar"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="tests-jvm/src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.json.simple"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="lib" path="/com.sap.sailing.targetplatform.base/plugins/target-test/mockito-core-1.10.14.jar"/>
|
||||
<classpathentry kind="var" path="ANDROID_HOME/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.jar"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.sap.sailing.racecommittee.app"
|
||||
android:versionCode="14"
|
||||
android:versionName="1.6">
|
||||
android:versionCode="16"
|
||||
android:versionName="1.8">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
apply plugin: "com.android.application"
|
||||
apply plugin: 'com.getkeepsafe.dexcount'
|
||||
apply from: "../git.gradle"
|
||||
|
||||
def packageName="com.sap.sailing.racecommittee.app"
|
||||
@@ -25,7 +26,7 @@ android {
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
java.srcDirs = ["src"]
|
||||
res.srcDirs = ["res"]
|
||||
assets.srcDirs = ["assets"]
|
||||
assets.srcDirs = ["assets", "assets_gen"]
|
||||
}
|
||||
|
||||
androidTest {
|
||||
@@ -72,7 +73,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.6.2"
|
||||
compile "com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.7.4"
|
||||
|
||||
/* support libraries */
|
||||
compile "com.android.support:appcompat-v7:${rootProject.ext.support}"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>com.h6ah4i.android.widget.advrecyclerview</groupId>
|
||||
<artifactId>advrecyclerview</artifactId>
|
||||
<version>0.6.2</version>
|
||||
<version>0.7.4</version>
|
||||
<type>aar</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
|
||||
# Project target.
|
||||
target=Google Inc.:Google APIs:22
|
||||
android.library.reference.1=../google-play-services_lib
|
||||
android.library.reference.2=../com.sap.sailing.android.shared
|
||||
android.library.reference.3=../google-android-support-v7-recyclerview_lib
|
||||
android.library.reference.4=../github-advrecyclerview_lib
|
||||
android.library.reference.5=../licensesdialog_lib/de.psdev.licensesdialog
|
||||
android.library.reference.1=..\\google-play-services_lib
|
||||
android.library.reference.2=..\\com.sap.sailing.android.shared
|
||||
android.library.reference.3=..\\google-android-support-v7-recyclerview_lib
|
||||
android.library.reference.4=..\\github-advrecyclerview_lib
|
||||
android.library.reference.5=..\\licensesdialog_lib\\de.psdev.licensesdialog
|
||||
android.library.reference.6=../google-android-support-v13
|
||||
@@ -78,13 +78,14 @@
|
||||
<string name="pick_a_rounding_direction">Wenderichtung auswählen</string>
|
||||
<string name="select_penalty_reason">Strafe auswählen</string>
|
||||
|
||||
<string-array name="rounding_directions">
|
||||
<item>Backbord</item>
|
||||
<item>Steuerbord</item>
|
||||
<item>Gate</item>
|
||||
<item>Linie</item>
|
||||
<item>Ablauf</item>
|
||||
</string-array>
|
||||
<string name="passing_instruction_none">Leer</string>
|
||||
<string name="passing_instruction_port">Backbord</string>
|
||||
<string name="passing_instruction_starboard">Steuerbord</string>
|
||||
<string name="passing_instruction_single_unknown">Einzel, unbekannt</string>
|
||||
<string name="passing_instruction_gate">Gate</string>
|
||||
<string name="passing_instruction_line">Linie</string>
|
||||
<string name="passing_instruction_offset">Ablauf</string>
|
||||
<string name="passing_instruction_fixed_bearing">Feste Peilung</string>
|
||||
|
||||
<string name="publish">Veröffentlichen</string>
|
||||
<string name="unpublish">Zurücknehmen</string>
|
||||
|
||||
@@ -91,13 +91,14 @@
|
||||
<string name="pick_a_rounding_direction">Pick a rounding direction</string>
|
||||
<string name="select_penalty_reason">Select penalty reason</string>
|
||||
|
||||
<string-array name="rounding_directions">
|
||||
<item>Port</item>
|
||||
<item>Starboard</item>
|
||||
<item>Gate</item>
|
||||
<item>Line</item>
|
||||
<item>Offset</item>
|
||||
</string-array>
|
||||
<string name="passing_instruction_none">None</string>
|
||||
<string name="passing_instruction_port">Port</string>
|
||||
<string name="passing_instruction_starboard">Starboard</string>
|
||||
<string name="passing_instruction_single_unknown">Single, Unknown</string>
|
||||
<string name="passing_instruction_gate">Gate</string>
|
||||
<string name="passing_instruction_line">Line</string>
|
||||
<string name="passing_instruction_offset">Offset</string>
|
||||
<string name="passing_instruction_fixed_bearing">Fixed Bearing</string>
|
||||
|
||||
<string name="publish">Publish</string>
|
||||
<string name="unpublish">Unpublish</string>
|
||||
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.adapters;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.DraggableItemViewHolder;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.SwipeableItemViewHolder;
|
||||
|
||||
public abstract class BaseDraggableSwipeViewHolder extends RecyclerView.ViewHolder
|
||||
implements DraggableItemViewHolder, SwipeableItemViewHolder {
|
||||
|
||||
private int mDragStateFlags;
|
||||
private int mSwipeStateFlags;
|
||||
private int mSwipeResult = RecyclerViewSwipeManager.RESULT_NONE;
|
||||
private int mAfterSwipeReaction = RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT;
|
||||
private float mSwipeAmount;
|
||||
|
||||
public BaseDraggableSwipeViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDragStateFlags(int flags) {
|
||||
mDragStateFlags = flags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDragStateFlags() {
|
||||
return mDragStateFlags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSwipeStateFlags(int flags) {
|
||||
mSwipeStateFlags = flags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSwipeStateFlags() {
|
||||
return mSwipeStateFlags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSwipeResult(int result) {
|
||||
mSwipeResult = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSwipeResult() {
|
||||
return mSwipeResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAfterSwipeReaction(int reaction) {
|
||||
mAfterSwipeReaction = reaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAfterSwipeReaction() {
|
||||
return mAfterSwipeReaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSwipeItemSlideAmount(float amount) {
|
||||
mSwipeAmount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSwipeItemSlideAmount() {
|
||||
return mSwipeAmount;
|
||||
}
|
||||
}
|
||||
+19
-20
@@ -2,6 +2,17 @@ package com.sap.sailing.racecommittee.app.ui.adapters;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.ItemDraggableRange;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.CompetitorResultWithIdImpl;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
@@ -10,16 +21,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.ItemDraggableRange;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.CompetitorResultWithIdImpl;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
|
||||
public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapter.ViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
@@ -80,7 +81,7 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckCanStartDrag(ViewHolder holder, int x, int y) {
|
||||
public boolean onCheckCanStartDrag(ViewHolder holder, int position, int x, int y) {
|
||||
// x, y --- relative from the itemView's top-left
|
||||
View containerView = holder.container;
|
||||
View dragHandleView = holder.dragHandle;
|
||||
@@ -92,7 +93,7 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDraggableRange onGetItemDraggableRange(ViewHolder viewHolder) {
|
||||
public ItemDraggableRange onGetItemDraggableRange(ViewHolder viewHolder, int position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -113,8 +114,8 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onGetSwipeReactionType(ViewHolder holder, int x, int y) {
|
||||
if (onCheckCanStartDrag(holder, x, y)) {
|
||||
public int onGetSwipeReactionType(ViewHolder holder, int position, int x, int y) {
|
||||
if (onCheckCanStartDrag(holder, position, x, y)) {
|
||||
return RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_BOTH;
|
||||
} else {
|
||||
return RecyclerViewSwipeManager.REACTION_CAN_SWIPE_BOTH;
|
||||
@@ -122,7 +123,7 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetSwipeBackground(ViewHolder viewHolder, int type) {
|
||||
public void onSetSwipeBackground(ViewHolder viewHolder, int position, int type) {
|
||||
int bgRes = 0;
|
||||
switch (type) {
|
||||
case RecyclerViewSwipeManager.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND:
|
||||
@@ -142,7 +143,7 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onSwipeItem(ViewHolder viewHolder, int result) {
|
||||
public int onSwipeItem(ViewHolder viewHolder, int position, int result) {
|
||||
switch (result) {
|
||||
case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
|
||||
case RecyclerViewSwipeManager.RESULT_SWIPED_RIGHT:
|
||||
@@ -154,11 +155,9 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPerformAfterSwipeReaction(ViewHolder holder, int result, int reaction) {
|
||||
public void onPerformAfterSwipeReaction(ViewHolder holder, int position, int result, int reaction) {
|
||||
switch (reaction) {
|
||||
case RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM:
|
||||
int position = holder.getAdapterPosition();
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onItemRemoved(mCompetitor.get(position));
|
||||
mCompetitor.remove(position);
|
||||
@@ -181,7 +180,7 @@ public class FinishListAdapter extends BaseDraggableSwipeAdapter<FinishListAdapt
|
||||
void onEditItem(CompetitorResultWithIdImpl item, int position);
|
||||
}
|
||||
|
||||
public class ViewHolder extends BaseDraggableSwipeViewHolder implements View.OnLongClickListener {
|
||||
public class ViewHolder extends AbstractDraggableSwipeableItemViewHolder implements View.OnLongClickListener {
|
||||
public View container;
|
||||
public View dragHandle;
|
||||
public View editItem;
|
||||
|
||||
+22
-25
@@ -3,6 +3,20 @@ package com.sap.sailing.racecommittee.app.ui.adapters.coursedesign;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.ItemDraggableRange;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.common.PassingInstruction;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.CourseListDataElementWithIdImpl;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.BaseDraggableSwipeAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.utils.MarkImageHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
@@ -13,20 +27,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.ItemDraggableRange;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager;
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.android.shared.util.ViewHelper;
|
||||
import com.sap.sailing.domain.common.PassingInstruction;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.CourseListDataElementWithIdImpl;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.BaseDraggableSwipeAdapter;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.BaseDraggableSwipeViewHolder;
|
||||
import com.sap.sailing.racecommittee.app.ui.utils.MarkImageHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
|
||||
public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final static String TAG = CourseElementAdapter.class.getName();
|
||||
@@ -195,7 +195,7 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckCanStartDrag(RecyclerView.ViewHolder holder, int x, int y) {
|
||||
public boolean onCheckCanStartDrag(RecyclerView.ViewHolder holder, int position, int x, int y) {
|
||||
if (holder instanceof ItemViewHolder) {
|
||||
ItemViewHolder itemHolder = (ItemViewHolder) holder;
|
||||
// x, y --- relative from the itemView's top-left
|
||||
@@ -212,7 +212,7 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemDraggableRange onGetItemDraggableRange(RecyclerView.ViewHolder holder) {
|
||||
public ItemDraggableRange onGetItemDraggableRange(RecyclerView.ViewHolder holder, int position) {
|
||||
if (mElements == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -233,8 +233,8 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onGetSwipeReactionType(RecyclerView.ViewHolder holder, int x, int y) {
|
||||
if (onCheckCanStartDrag(holder, x, y)) {
|
||||
public int onGetSwipeReactionType(RecyclerView.ViewHolder holder, int position, int x, int y) {
|
||||
if (onCheckCanStartDrag(holder, position, x, y)) {
|
||||
return RecyclerViewSwipeManager.REACTION_CAN_NOT_SWIPE_BOTH;
|
||||
} else {
|
||||
return RecyclerViewSwipeManager.REACTION_CAN_SWIPE_BOTH;
|
||||
@@ -242,7 +242,7 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetSwipeBackground(RecyclerView.ViewHolder holder, int type) {
|
||||
public void onSetSwipeBackground(RecyclerView.ViewHolder holder, int position, int type) {
|
||||
if (holder instanceof ItemViewHolder) {
|
||||
int bgRes = 0;
|
||||
switch (type) {
|
||||
@@ -265,7 +265,7 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onSwipeItem(RecyclerView.ViewHolder holder, int result) {
|
||||
public int onSwipeItem(RecyclerView.ViewHolder holder, int position, int result) {
|
||||
if (holder instanceof ItemViewHolder) {
|
||||
switch (result) {
|
||||
case RecyclerViewSwipeManager.RESULT_SWIPED_LEFT:
|
||||
@@ -281,12 +281,9 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPerformAfterSwipeReaction(RecyclerView.ViewHolder holder, int result, int reaction) {
|
||||
public void onPerformAfterSwipeReaction(RecyclerView.ViewHolder holder, int position, int result, int reaction) {
|
||||
ExLog.i(mContext, TAG, "onPerformAfterSwipeReaction() called with: " + "holder = [" + holder + "], result = [" + result + "], reaction = [" + reaction + "]");
|
||||
|
||||
int position = holder.getAdapterPosition();
|
||||
CourseListDataElementWithIdImpl element = mElements.get(position);
|
||||
|
||||
switch (reaction) {
|
||||
case RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_REMOVE_ITEM:
|
||||
mElements.remove(element);
|
||||
@@ -335,7 +332,7 @@ public class CourseElementAdapter extends BaseDraggableSwipeAdapter<RecyclerView
|
||||
}
|
||||
}
|
||||
|
||||
public class ItemViewHolder extends BaseDraggableSwipeViewHolder implements View.OnClickListener {
|
||||
public class ItemViewHolder extends AbstractDraggableSwipeableItemViewHolder implements View.OnClickListener {
|
||||
|
||||
public ViewGroup container;
|
||||
public View dragHandle;
|
||||
|
||||
+48
-2
@@ -453,15 +453,61 @@ public class CourseFragmentMarks extends CourseFragment implements CourseMarkAda
|
||||
|
||||
private void createPassingInstructionDialog(final CourseListDataElementWithIdImpl courseElement) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_AlertDialog);
|
||||
builder.setTitle(R.string.pick_a_rounding_direction).setItems(R.array.rounding_directions, new DialogInterface.OnClickListener() {
|
||||
final PassingInstruction[] passingInstructionsRelevantForUserEntry = PassingInstruction.relevantValues();
|
||||
final CharSequence[] i18NPassingInstructions = getI18NPassingInstructions(passingInstructionsRelevantForUserEntry);
|
||||
builder.setTitle(R.string.pick_a_rounding_direction).setItems(i18NPassingInstructions, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int position) {
|
||||
PassingInstruction pickedDirection = PassingInstruction.relevantValues()[position];
|
||||
PassingInstruction pickedDirection = passingInstructionsRelevantForUserEntry[position];
|
||||
onPassingInstructionPicked(courseElement, pickedDirection);
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cosntructs a message text for each of the {@link PassingIntsruction} values passed. The message strings
|
||||
* returned correspond in their order with the {@link PassingInstruction}s passed in the array.
|
||||
*/
|
||||
private CharSequence[] getI18NPassingInstructions(PassingInstruction[] passingInstructionsRelevantForUserEntry) {
|
||||
final CharSequence[] result = new CharSequence[passingInstructionsRelevantForUserEntry.length];
|
||||
int i=0;
|
||||
for (final PassingInstruction passingInstruction : passingInstructionsRelevantForUserEntry) {
|
||||
result[i++] = getI18NPassingInstruction(passingInstruction);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private CharSequence getI18NPassingInstruction(PassingInstruction passingInstruction) {
|
||||
CharSequence result = "";
|
||||
switch (passingInstruction) {
|
||||
case FixedBearing:
|
||||
result = getString(R.string.passing_instruction_fixed_bearing);
|
||||
break;
|
||||
case Gate:
|
||||
result = getString(R.string.passing_instruction_gate);
|
||||
break;
|
||||
case Line:
|
||||
result = getString(R.string.passing_instruction_line);
|
||||
break;
|
||||
case None:
|
||||
result = getString(R.string.passing_instruction_none);
|
||||
break;
|
||||
case Offset:
|
||||
result = getString(R.string.passing_instruction_offset);
|
||||
break;
|
||||
case Port:
|
||||
result = getString(R.string.passing_instruction_port);
|
||||
break;
|
||||
case Single_Unknown:
|
||||
result = getString(R.string.passing_instruction_single_unknown);
|
||||
break;
|
||||
case Starboard:
|
||||
result = getString(R.string.passing_instruction_starboard);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void onPassingInstructionPicked(CourseListDataElementWithIdImpl courseElement, PassingInstruction pickedDirection) {
|
||||
courseElement.setPassingInstructions(pickedDirection);
|
||||
if (!PassingInstruction.Gate.equals(pickedDirection) && !PassingInstruction.Line.equals(pickedDirection)) {
|
||||
|
||||
Reference in new issue
Block a user