mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
Merge branch 'master' of ssh://sapsailing.com/home/trac/git into bug4576
This commit is contained in:
commit
e56fc3f272
26 files changed
+835
-140
No files matched your search
+6
-6
@@ -1,9 +1,5 @@
|
||||
package com.sap.sailing.android.shared.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
@@ -16,6 +12,10 @@ import android.util.Log;
|
||||
|
||||
import com.sap.sailing.android.shared.R;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class AppUtils {
|
||||
|
||||
private final static String TAG = AppUtils.class.getName();
|
||||
@@ -37,9 +37,9 @@ public class AppUtils {
|
||||
*/
|
||||
public static void lockOrientation(Activity activity) {
|
||||
if (with(activity).isPhone()) {
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||
} else {
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/compass_view_compass"
|
||||
android:scaleType="centerInside"
|
||||
android:src="?attr/compass_back" />
|
||||
|
||||
<com.sap.sailing.racecommittee.app.ui.views.BackAwareEditText
|
||||
@@ -42,6 +43,7 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/compass_view_needle"
|
||||
android:scaleType="centerInside"
|
||||
android:src="?attr/compass_needle" />
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?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:id="@+id/tools_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -9,13 +8,25 @@
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/list_button_layout"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="?attr/sap_gray">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="?attr/list_single_24dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<com.sap.sailing.racecommittee.app.ui.views.SearchView
|
||||
android:id="@+id/competitor_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true" />
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/competitor_sort"
|
||||
@@ -32,30 +43,15 @@
|
||||
android:src="?attr/sortby_24dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/list_button_layout"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="?attr/sap_gray">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="?attr/list_single_24dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/competitor_entry_count"
|
||||
style="?attr/textSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_toLeftOf="@id/competitor_sort"
|
||||
android:layout_toRightOf="@id/list_button_layout"
|
||||
tools:text="@string/competitor_count" />
|
||||
</RelativeLayout>
|
||||
android:layout_toRightOf="@id/list_button_layout" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -22,6 +22,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/header_margin_top"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="?attr/textPanelHeader"
|
||||
android:visibility="visible"
|
||||
tools:text="@string/start_mode" />
|
||||
@@ -33,6 +34,7 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="@dimen/header_margin_top"
|
||||
android:gravity="center_horizontal"
|
||||
android:textAppearance="?attr/textPanelCaption"
|
||||
android:visibility="gone"
|
||||
tools:text="@string/start_mode" />
|
||||
|
||||
@@ -82,4 +82,4 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="?attr/black" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
+23
-21
@@ -46,52 +46,54 @@
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/side_padding"
|
||||
android:paddingLeft="@dimen/side_padding"
|
||||
android:paddingRight="@dimen/side_padding"
|
||||
android:paddingTop="@dimen/side_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
<Button
|
||||
android:id="@+id/takeHistoryCourse"
|
||||
style="?attr/buttonSolidNormal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="horizontal">
|
||||
android:text="@string/take_previous" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/takeHistoryCourse"
|
||||
style="?attr/buttonSolidNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/take_previous" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/unpublishCourse"
|
||||
style="?attr/buttonSolidNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/unpublish" />
|
||||
|
||||
<View
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/publishCourse"
|
||||
style="?attr/buttonSolidNormal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/publish" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -122,4 +124,4 @@
|
||||
android:verticalSpacing="5dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
@@ -2,17 +2,19 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="?attr/sap_gray"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_input"
|
||||
style="?attr/editText"
|
||||
android:layout_width="170dp"
|
||||
android:layout_width="@dimen/search_view_size"
|
||||
android:layout_height="50dp"
|
||||
android:inputType="textNoSuggestions|"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:textAppearance="?attr/textNormal"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/search_button"
|
||||
@@ -28,4 +30,4 @@
|
||||
android:layout_gravity="center"
|
||||
android:src="?attr/search_24dp" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -26,4 +26,4 @@
|
||||
<dimen name="login_text_size_small">@dimen/textSize_22</dimen>
|
||||
<dimen name="login_text_size">@dimen/textSize_26</dimen>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
@@ -132,4 +132,6 @@
|
||||
<!-- photo -->
|
||||
<dimen name="photo_shutter_size">45dp</dimen>
|
||||
|
||||
</resources>
|
||||
<dimen name="search_view_size">125dp</dimen>
|
||||
|
||||
</resources>
|
||||
+8
-3
@@ -96,6 +96,7 @@ public class PenaltyFragment extends BaseFragment implements PopupMenu.OnMenuIte
|
||||
private ImageView mListButton;
|
||||
private HeaderLayout mHeader;
|
||||
private StateChangeListener mStateChangeListener;
|
||||
private SearchView mSearchView;
|
||||
|
||||
public static PenaltyFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
@@ -115,9 +116,9 @@ public class PenaltyFragment extends BaseFragment implements PopupMenu.OnMenuIte
|
||||
mCompetitorResults = new CompetitorResultsList<>(new ArrayList<CompetitorResultEditableImpl>());
|
||||
mDraftData = new CompetitorResultsImpl();
|
||||
mConfirmedData = new CompetitorResultsImpl();
|
||||
SearchView searchView = ViewHelper.get(layout, R.id.competitor_search);
|
||||
if (searchView != null) {
|
||||
searchView.setSearchTextWatcher(this);
|
||||
mSearchView = ViewHelper.get(layout, R.id.competitor_search);
|
||||
if (mSearchView != null) {
|
||||
mSearchView.setSearchTextWatcher(this);
|
||||
}
|
||||
mHeader = ViewHelper.get(layout, R.id.header);
|
||||
mListButtonLayout = ViewHelper.get(layout, R.id.list_button_layout);
|
||||
@@ -277,11 +278,15 @@ public class PenaltyFragment extends BaseFragment implements PopupMenu.OnMenuIte
|
||||
mListButtonLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (mListButtonLayout != null) {
|
||||
mListButtonLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (mListButtonLayout != null) {
|
||||
mSearchView.isEditSmall(mListButtonLayout.getVisibility() == View.VISIBLE);
|
||||
}
|
||||
initLocalData();
|
||||
loadCompetitors();
|
||||
}
|
||||
|
||||
+1
@@ -199,6 +199,7 @@ public class TrackingListFragment extends BaseFragment
|
||||
SearchView searchView = ViewHelper.get(layout, R.id.competitor_search);
|
||||
if (searchView != null) {
|
||||
searchView.setSearchTextWatcher(this);
|
||||
searchView.isEditSmall(true);
|
||||
}
|
||||
View sortByButton = ViewHelper.get(layout, R.id.competitor_sort);
|
||||
if (sortByButton != null) {
|
||||
|
||||
+34
-13
@@ -1,10 +1,12 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.views;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -19,6 +21,8 @@ import android.widget.TextView;
|
||||
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class CompassView extends RelativeLayout {
|
||||
|
||||
private CompassDirectionListener changeListener;
|
||||
@@ -29,19 +33,18 @@ public class CompassView extends RelativeLayout {
|
||||
private float currentDegrees;
|
||||
private Float deferredToDegrees;
|
||||
|
||||
public CompassView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
inflate();
|
||||
public CompassView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CompassView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
inflate();
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public CompassView(Context context) {
|
||||
super(context);
|
||||
inflate();
|
||||
public CompassView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.compass_view, this);
|
||||
}
|
||||
|
||||
private float getNeedlePivotX() {
|
||||
@@ -52,9 +55,26 @@ public class CompassView extends RelativeLayout {
|
||||
return needleView.getMeasuredHeight() / 2;
|
||||
}
|
||||
|
||||
private void inflate() {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.compass_view, this);
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
|
||||
int size;
|
||||
if (widthMode == MeasureSpec.EXACTLY && widthSize > 0) {
|
||||
size = widthSize;
|
||||
} else if (heightMode == MeasureSpec.EXACTLY && heightSize > 0) {
|
||||
size = heightSize;
|
||||
} else {
|
||||
size = widthSize < heightSize ? widthSize : heightSize;
|
||||
}
|
||||
|
||||
degreeView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size / 10);
|
||||
|
||||
int finalMeasureSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY);
|
||||
super.onMeasure(finalMeasureSpec, finalMeasureSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +90,7 @@ public class CompassView extends RelativeLayout {
|
||||
public void onImeBack(BackAwareEditText editText) {
|
||||
float degree = currentDegrees > 0 ? currentDegrees : currentDegrees + 360;
|
||||
degreeView.clearFocus();
|
||||
degreeView.setText(String.format("%.0f°", degree));
|
||||
degreeView.setText(String.format(Locale.getDefault(), "%.0f°", degree));
|
||||
degreeValue.setText(degreeView.getText());
|
||||
}
|
||||
});
|
||||
@@ -117,6 +137,7 @@ public class CompassView extends RelativeLayout {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
float rotateX = (-1) * (event.getY() - needleView.getY() - getNeedlePivotY());
|
||||
@@ -166,7 +187,7 @@ public class CompassView extends RelativeLayout {
|
||||
if (degree >= 359.5f) {
|
||||
degree = 0;
|
||||
}
|
||||
degreeView.setText(String.format("%.0f°", degree));
|
||||
degreeView.setText(String.format(Locale.getDefault(), "%.0f°", degree));
|
||||
degreeValue.setText(degreeView.getText());
|
||||
}
|
||||
}
|
||||
|
||||
+26
-10
@@ -1,5 +1,8 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.views;
|
||||
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.util.AttributeSet;
|
||||
@@ -9,16 +12,13 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.sap.sailing.android.shared.util.BitmapHelper;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class SearchView extends FrameLayout {
|
||||
|
||||
private ImageView mSearchIcon;
|
||||
private EditText mEditText;
|
||||
private SearchTextWatcher mWatcher;
|
||||
|
||||
private boolean mCollapsed = true;
|
||||
|
||||
public SearchView(Context context) {
|
||||
@@ -32,9 +32,14 @@ public class SearchView extends FrameLayout {
|
||||
public SearchView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
View layout = LayoutInflater.from(context).inflate(R.layout.search_view, this, false);
|
||||
LayoutInflater.from(context).inflate(R.layout.search_view, this);
|
||||
}
|
||||
|
||||
mEditText = (EditText) layout.findViewById(R.id.search_input);
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mEditText = (EditText) findViewById(R.id.search_input);
|
||||
if (mEditText != null) {
|
||||
mEditText.setVisibility(getResources().getBoolean(R.bool.penalty_search_open) ? VISIBLE : GONE);
|
||||
mEditText.addTextChangedListener(new android.text.TextWatcher() {
|
||||
@@ -56,11 +61,11 @@ public class SearchView extends FrameLayout {
|
||||
}
|
||||
});
|
||||
}
|
||||
mSearchIcon = (ImageView) layout.findViewById(R.id.search_icon);
|
||||
mSearchIcon = (ImageView) findViewById(R.id.search_icon);
|
||||
if (mSearchIcon != null && getResources().getBoolean(R.bool.penalty_search_open)) {
|
||||
mSearchIcon.setImageDrawable(BitmapHelper.getAttrDrawable(getContext(), R.attr.clear_24dp));
|
||||
}
|
||||
View searchButton = layout.findViewById(R.id.search_button);
|
||||
View searchButton = findViewById(R.id.search_button);
|
||||
if (searchButton != null) {
|
||||
searchButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -69,14 +74,25 @@ public class SearchView extends FrameLayout {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addView(layout);
|
||||
}
|
||||
|
||||
public void setSearchTextWatcher(SearchTextWatcher watcher) {
|
||||
mWatcher = watcher;
|
||||
}
|
||||
|
||||
public void isEditSmall(boolean smallEdit) {
|
||||
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mEditText.getLayoutParams();
|
||||
if (params != null) {
|
||||
int width = getResources().getDimensionPixelSize(R.dimen.search_view_size);
|
||||
if (smallEdit) {
|
||||
width -= mSearchIcon.getWidth();
|
||||
}
|
||||
params.width = width;
|
||||
mEditText.setLayoutParams(params);
|
||||
mEditText.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void onClickButton(boolean startOpen) {
|
||||
if (startOpen) {
|
||||
mEditText.setText(null);
|
||||
|
||||
Reference in new issue
Block a user