mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 01:16:40 +00:00
Merge remote-tracking branch 'server/ubilabs--rcapp--bug-3595' into ubilabs--rcapp--develop
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/dark_sap_gray">
|
||||
|
||||
<item android:drawable="@color/dark_sap_gray_black_30"/>
|
||||
|
||||
</ripple>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/light_sap_gray">
|
||||
|
||||
<item android:drawable="@color/light_sap_gray_black_30"/>
|
||||
|
||||
</ripple>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- pressed -->
|
||||
<item android:drawable="@color/dark_sap_gray" android:state_pressed="true" />
|
||||
|
||||
<!-- default -->
|
||||
<item android:drawable="@color/dark_sap_gray_black_30" />
|
||||
|
||||
</selector>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- pressed -->
|
||||
<item android:drawable="@color/light_sap_gray" android:state_pressed="true" />
|
||||
|
||||
<!-- default -->
|
||||
<item android:drawable="@color/light_sap_gray_black_30" />
|
||||
|
||||
</selector>
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/sap_gray_black_30"
|
||||
android:background="?attr/checkedItemBackground"
|
||||
android:minHeight="@dimen/listView_row_min_height">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
|
||||
<item name="android:alertDialogTheme">@style/AppTheme.Dark.AlertDialog.v21</item>
|
||||
|
||||
<item name="checkedItemBackground">@drawable/checked_item_background_dark_ripple</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.AlertDialog.v21" parent="Theme.AppCompat.Light.Dialog">
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
|
||||
<item name="android:alertDialogTheme">@style/AppTheme.Light.AlertDialog.v21</item>
|
||||
|
||||
<item name="checkedItemBackground">@drawable/checked_item_background_light_ripple</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light.AlertDialog.v21" parent="Theme.AppCompat.Light.Dialog">
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<attr name="buttonSolidXSmall" format="reference"/>
|
||||
<attr name="buttonSolidSmall" format="reference"/>
|
||||
<attr name="buttonSolidNormal" format="reference"/>
|
||||
<attr name="checkedItemBackground" format="reference"/>
|
||||
<attr name="round" format="reference"/>
|
||||
<attr name="round_transparent" format="reference"/>
|
||||
<attr name="text" format="reference"/>
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<item name="buttonSolidXSmall">@style/AppTheme.Dark.Button.XSmall</item>
|
||||
<item name="buttonSolidSmall">@style/AppTheme.Dark.Button.Small</item>
|
||||
<item name="buttonSolidNormal">@style/AppTheme.Dark.Button.Normal</item>
|
||||
<item name="checkedItemBackground">@drawable/checked_item_background_dark</item>
|
||||
<item name="round">@style/AppTheme.Dark.Round</item>
|
||||
<item name="round_transparent">@style/AppTheme.Dark.RoundTransparent</item>
|
||||
<item name="text">@style/AppTheme.Dark.Text</item>
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
<!-- colors -->
|
||||
<item name="black">@color/light_black</item>
|
||||
<item name="sap_blue_1">@color/constant_sap_blue_1</item>
|
||||
<item name="sap_gray">@color/light_sap_gray</item>
|
||||
<item name="sap_gray">@color/light_sap_gray</item> <!-- ripple -->
|
||||
<item name="sap_gray_black_20">@color/light_sap_gray_black_20</item>
|
||||
<item name="sap_gray_black_30">@color/light_sap_gray_black_30</item>
|
||||
<item name="sap_gray_black_30">@color/light_sap_gray_black_30</item> <!-- bg -->
|
||||
<item name="sap_gray_black_40">@color/light_sap_gray_black_40</item>
|
||||
<item name="sap_gray_white_10">@color/light_sap_gray_white_10</item>
|
||||
<item name="sap_gray_white_20">@color/light_sap_gray_white_20</item>
|
||||
<item name="sap_light_gray">@color/light_sap_light_gray</item>
|
||||
<item name="sap_light_gray">@color/light_sap_light_gray</item> <!-- unselected -->
|
||||
<item name="sap_red_1">@color/constant_sap_red_1</item>
|
||||
<item name="sap_yellow_1">@color/constant_sap_yellow_1</item>
|
||||
<item name="white">@color/white_light</item>
|
||||
<item name="white">@color/white_light</item> <!-- selected / init -->
|
||||
<item name="white_invert">@color/constant_white</item>
|
||||
|
||||
<!-- styles -->
|
||||
@@ -45,6 +45,7 @@
|
||||
<item name="buttonSolidXSmall">@style/AppTheme.Light.Button.XSmall</item>
|
||||
<item name="buttonSolidSmall">@style/AppTheme.Light.Button.Small</item>
|
||||
<item name="buttonSolidNormal">@style/AppTheme.Light.Button.Normal</item>
|
||||
<item name="checkedItemBackground">@drawable/checked_item_background_light</item>
|
||||
<item name="round">@style/AppTheme.Light.Round</item>
|
||||
<item name="round_transparent">@style/AppTheme.Light.RoundTransparent</item>
|
||||
<item name="text">@style/AppTheme.Light.Text</item>
|
||||
|
||||
+9
@@ -6,6 +6,7 @@ public class CheckedItem {
|
||||
protected Drawable mImage;
|
||||
protected String mText;
|
||||
protected String mSubText;
|
||||
protected boolean mDisabled = false;
|
||||
|
||||
public Drawable getImage() {
|
||||
return mImage;
|
||||
@@ -30,4 +31,12 @@ public class CheckedItem {
|
||||
public void setSubtext(String subText) {
|
||||
mSubText = subText;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return !mDisabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean isDisabled) {
|
||||
mDisabled = isDisabled;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-1
@@ -48,7 +48,11 @@ public class CheckedItemAdapter extends ArrayAdapter<CheckedItem> {
|
||||
mainTextView.setText(item.getText());
|
||||
if (checkedPosition != -1) {
|
||||
if (position != checkedPosition) {
|
||||
mainTextView.setTextColor(ThemeHelper.getColor(getContext(), R.attr.sap_light_gray));
|
||||
if (item.isEnabled()) {
|
||||
mainTextView.setTextColor(ThemeHelper.getColor(getContext(), R.attr.sap_light_gray));
|
||||
} else {
|
||||
mainTextView.setTextColor(ThemeHelper.getColor(getContext(), R.attr.sap_gray_white_10));
|
||||
}
|
||||
mainTextView.setTypeface(Typeface.DEFAULT);
|
||||
checkImageView.setVisibility(View.GONE);
|
||||
} else {
|
||||
@@ -56,6 +60,8 @@ public class CheckedItemAdapter extends ArrayAdapter<CheckedItem> {
|
||||
mainTextView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
checkImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (!item.isEnabled()) {
|
||||
mainTextView.setTextColor(ThemeHelper.getColor(getContext(), R.attr.sap_gray_white_10));
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(item.getSubtext())) {
|
||||
@@ -70,6 +76,11 @@ public class CheckedItemAdapter extends ArrayAdapter<CheckedItem> {
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int position) {
|
||||
return getItem(position).isEnabled();
|
||||
}
|
||||
|
||||
public void setCheckedPosition(int position) {
|
||||
checkedPosition = position;
|
||||
}
|
||||
|
||||
+23
-2
@@ -2,6 +2,7 @@ package com.sap.sailing.racecommittee.app.ui.fragments.lists;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
@@ -9,8 +10,10 @@ import android.os.Bundle;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.AppPreferences;
|
||||
import com.sap.sailing.racecommittee.app.data.ReadonlyDataManager;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.DataLoaderResult;
|
||||
import com.sap.sailing.racecommittee.app.ui.adapters.checked.CheckedItem;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.selection.CourseAreaSelectedListenerHost;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.selection.ItemSelectedListener;
|
||||
|
||||
@@ -39,8 +42,8 @@ public class CourseAreaListFragment extends NamedListFragment<CourseArea> {
|
||||
return listener.getCourseAreaSelectionListener();
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("%s cannot be attached to a instance of %s",
|
||||
CourseAreaListFragment.class.getName(), activity.getClass().getName()));
|
||||
throw new IllegalStateException(String
|
||||
.format("%s cannot be attached to a instance of %s", CourseAreaListFragment.class.getName(), activity.getClass().getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,6 +51,24 @@ public class CourseAreaListFragment extends NamedListFragment<CourseArea> {
|
||||
return manager.createCourseAreasLoader(parentEventId, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadSucceeded(Collection<CourseArea> data, boolean isCached) {
|
||||
super.onLoadSucceeded(data, isCached);
|
||||
|
||||
for (CheckedItem item : checkedItems) {
|
||||
item.setDisabled(true);
|
||||
}
|
||||
|
||||
List<String> courses = AppPreferences.on(getActivity()).getManagedCourseAreaNames();
|
||||
for (CheckedItem item : checkedItems) {
|
||||
for (String allowedCourse : courses) {
|
||||
if ("*".equals(allowedCourse) || allowedCourse.equals(item.getText())) {
|
||||
item.setDisabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialogResultListener getListener() {
|
||||
return (DialogResultListener) getActivity();
|
||||
|
||||
-1
@@ -86,7 +86,6 @@ public abstract class NamedListFragment<T extends Named> extends LoggableListFra
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView listView, View view, int position, long id) {
|
||||
super.onListItemClick(listView, view, position, id);
|
||||
listAdapter.setCheckedPosition(position);
|
||||
|
||||
mSelectedIndex = position;
|
||||
|
||||
Reference in New Issue
Block a user