mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
bug3980: showing all races in one fragment for protest time entry on smartphone/portrait
Change-Id: I1ee1f44d5e2ed46d5433ba601f7b3c96696324c9
This commit is contained in:
1 parent
70294c886d
commit
81c4a3d889
12 files changed
+26
-19
No files matched your search
+2
-2
@@ -150,7 +150,7 @@ public class AppUtils {
|
||||
*
|
||||
* @return true, if portrait mode
|
||||
*/
|
||||
public boolean isPort() {
|
||||
public boolean isPortrait() {
|
||||
return mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class AppUtils {
|
||||
*
|
||||
* @return true, if landscape mode
|
||||
*/
|
||||
public boolean isLand() {
|
||||
public boolean isLandscape() {
|
||||
return mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class SelectionAdapter extends RecyclerView.Adapter<SelectionAdapter.View
|
||||
holder.mSwitch.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (AppUtils.with(mContext).is10inch() && AppUtils.with(mContext).isLand()) {
|
||||
if (AppUtils.with(mContext).is10inch() && AppUtils.with(mContext).isLandscape()) {
|
||||
int minHeight = mContext.getResources().getDimensionPixelSize(R.dimen.selector_header_min_height);
|
||||
int height = mParent.getMeasuredHeight() / mItems.size();
|
||||
int maxHeight = mContext.getResources().getDimensionPixelSize(R.dimen.selector_header_height);
|
||||
|
||||
+2
-2
@@ -179,7 +179,7 @@ public class LoginListViews extends LoggableDialogFragment implements View.OnCli
|
||||
// open the frame
|
||||
if (mFrame.getLayoutParams().height == 0) {
|
||||
mFrame.getLocationOnScreen(pos);
|
||||
if ((mAppUtils.isPhone() && mAppUtils.isLand()) || (mAppUtils.isPhone() && mAppUtils.isHDPI())) {
|
||||
if ((mAppUtils.isPhone() && mAppUtils.isLandscape()) || (mAppUtils.isPhone() && mAppUtils.isHDPI())) {
|
||||
if (mLayouts != null) {
|
||||
for (View view : mLayouts) {
|
||||
setVisibility(view, View.GONE);
|
||||
@@ -199,7 +199,7 @@ public class LoginListViews extends LoggableDialogFragment implements View.OnCli
|
||||
|
||||
public void close() {
|
||||
if (mFrame != null && mFrame.getLayoutParams() != null) {
|
||||
if ((!mAppUtils.is10inch() && mAppUtils.isLand()) || mAppUtils.isPhone() && mAppUtils.isHDPI() ) {
|
||||
if ((!mAppUtils.is10inch() && mAppUtils.isLandscape()) || mAppUtils.isPhone() && mAppUtils.isHDPI() ) {
|
||||
if (mLayouts != null) {
|
||||
for (View view : mLayouts) {
|
||||
setVisibility(view, View.VISIBLE);
|
||||
|
||||
+13
-6
@@ -446,24 +446,31 @@ public class RaceListFragment extends LoggableFragment implements OnItemClickLis
|
||||
|
||||
private void showProtestTimeDialog(String raceGroupSeriesDisplayName) {
|
||||
// Find the race group for which the
|
||||
List<ManagedRace> races = new ArrayList<>();
|
||||
for (RaceGroupSeriesFleet raceGroupSeriesFleet : mRacesByGroup.keySet()) {
|
||||
Boolean matchingRaceGroup = raceGroupSeriesDisplayName.equals(
|
||||
new RaceGroupSeries(raceGroupSeriesFleet.getRaceGroup(), raceGroupSeriesFleet.getSeries()).getDisplayName());
|
||||
if (matchingRaceGroup) {
|
||||
List<ManagedRace> races = mRacesByGroup.get(raceGroupSeriesFleet);
|
||||
if (!isRaceListDirty(races)) {
|
||||
ProtestTimeDialogFragment fragment = ProtestTimeDialogFragment.newInstance(races);
|
||||
// collect all races for a single fragment in case of portrait mode;
|
||||
// show multiple fragments after one another in case of non-portrait (landscape) mode
|
||||
View view = getActivity().findViewById(R.id.protest_time_fragment);
|
||||
if (AppUtils.with(getActivity()).isPort() && view != null) {
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.protest_time_fragment, fragment);
|
||||
transaction.commit();
|
||||
if (AppUtils.with(getActivity()).isPortrait() && view != null) {
|
||||
races.addAll(mRacesByGroup.get(raceGroupSeriesFleet));
|
||||
} else {
|
||||
races = mRacesByGroup.get(raceGroupSeriesFleet);
|
||||
ProtestTimeDialogFragment fragment = ProtestTimeDialogFragment.newInstance(races);
|
||||
fragment.show(getFragmentManager(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (AppUtils.with(getActivity()).isPortrait() && (getActivity().findViewById(R.id.protest_time_fragment)) != null) {
|
||||
ProtestTimeDialogFragment fragment = ProtestTimeDialogFragment.newInstance(races);
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.protest_time_fragment, fragment);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isRaceListDirty(List<ManagedRace> races) {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public abstract class BaseRaceInfoRaceFragment<ProcedureType extends RacingProce
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
replaceFragment(FlagPanelFragment.newInstance(getArguments()), R.id.race_panel_flags);
|
||||
if (AppUtils.with(getActivity()).isTablet() && AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isTablet() && AppUtils.with(getActivity()).isLandscape()) {
|
||||
replaceFragment(SetupPanelFragment.newInstance(getArguments(), 0), R.id.race_panel_setup);
|
||||
replaceFragment(TimePanelFragment.newInstance(getArguments()), R.id.race_panel_time);
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public abstract class CourseFragment extends BaseFragment {
|
||||
});
|
||||
switch (getArguments().getInt(START_MODE, START_MODE_PRESETUP)) {
|
||||
case START_MODE_PLANNED:
|
||||
if (AppUtils.with(getActivity()).isLand() && AppUtils.with(getActivity()).is10inch()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape() && AppUtils.with(getActivity()).is10inch()) {
|
||||
header.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class MoreFlagsFragment extends BaseFragment implements MoreFlagItemClick
|
||||
|
||||
switch (getArguments().getInt(START_MODE, 0)) {
|
||||
case 0: // Race-State: Running -> Start Finishing
|
||||
if (AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape()) {
|
||||
if (header != null) {
|
||||
header.setOnClickListener(null);
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class RaceFactorFragment extends BaseFragment implements View.OnClickList
|
||||
if (getView() != null && getArguments() != null) {
|
||||
switch (getArguments().getInt(START_MODE, START_MODE_PRESETUP)) {
|
||||
case START_MODE_PLANNED:
|
||||
if (AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape()) {
|
||||
mHeader.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class StartModeFragment extends BaseFragment {
|
||||
if (getArguments() != null) {
|
||||
switch (getArguments().getInt(START_MODE, START_MODE_PRESETUP)) {
|
||||
case START_MODE_PLANNED:
|
||||
if (AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape()) {
|
||||
if (getView() != null) {
|
||||
View header = getView().findViewById(R.id.header);
|
||||
header.setVisibility(View.GONE);
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class StartProcedureFragment extends BaseFragment {
|
||||
if (getView() != null && getArguments() != null) {
|
||||
switch (getArguments().getInt(START_MODE, START_MODE_PRESETUP)) {
|
||||
case START_MODE_PLANNED:
|
||||
if (AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape()) {
|
||||
mHeader.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ public class StartTimeFragment extends BaseFragment
|
||||
time.setTime(mStartTime.asDate());
|
||||
}
|
||||
}
|
||||
if (AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape()) {
|
||||
if (header != null) {
|
||||
header.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ public class WindFragment extends BaseFragment implements CompassDirectionListen
|
||||
private void setupLayouts(boolean showMap) {
|
||||
if (mHeaderLayout != null) {
|
||||
if (getArguments() != null && getArguments().getInt(START_MODE, START_MODE_PRESETUP) == START_MODE_PLANNED) {
|
||||
if (AppUtils.with(getActivity()).isLand()) {
|
||||
if (AppUtils.with(getActivity()).isLandscape()) {
|
||||
mHeaderLayout.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user