Push conditionals inside branch expressions
This commit is contained in:
parent
6909d1e527
commit
31cffa68c5
7 changed files with 26 additions and 26 deletions
|
@ -646,7 +646,7 @@ public class DownloadDialog extends DialogFragment
|
||||||
mainStorage = mainStorageVideo; // subtitle & video files go together
|
mainStorage = mainStorageVideo; // subtitle & video files go together
|
||||||
format = subtitleStreamsAdapter.getItem(selectedSubtitleIndex).getFormat();
|
format = subtitleStreamsAdapter.getItem(selectedSubtitleIndex).getFormat();
|
||||||
mime = format.mimeType;
|
mime = format.mimeType;
|
||||||
filename += format == MediaFormat.TTML ? MediaFormat.SRT.suffix : format.suffix;
|
filename += (format == MediaFormat.TTML ? MediaFormat.SRT : format).suffix;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("No stream selected");
|
throw new RuntimeException("No stream selected");
|
||||||
|
|
|
@ -1246,9 +1246,9 @@ public class VideoDetailFragment
|
||||||
final DisplayMetrics metrics = getResources().getDisplayMetrics();
|
final DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||||
|
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
final int height = isInMultiWindow()
|
final int height = (isInMultiWindow()
|
||||||
? requireView().getHeight()
|
? requireView()
|
||||||
: activity.getWindow().getDecorView().getHeight();
|
: activity.getWindow().getDecorView()).getHeight();
|
||||||
setHeightThumbnail(height, metrics);
|
setHeightThumbnail(height, metrics);
|
||||||
getView().getViewTreeObserver().removeOnPreDrawListener(preDrawListener);
|
getView().getViewTreeObserver().removeOnPreDrawListener(preDrawListener);
|
||||||
}
|
}
|
||||||
|
@ -1269,9 +1269,9 @@ public class VideoDetailFragment
|
||||||
requireView().getViewTreeObserver().removeOnPreDrawListener(preDrawListener);
|
requireView().getViewTreeObserver().removeOnPreDrawListener(preDrawListener);
|
||||||
|
|
||||||
if (player != null && player.isFullscreen()) {
|
if (player != null && player.isFullscreen()) {
|
||||||
final int height = isInMultiWindow()
|
final int height = (isInMultiWindow()
|
||||||
? requireView().getHeight()
|
? requireView()
|
||||||
: activity.getWindow().getDecorView().getHeight();
|
: activity.getWindow().getDecorView()).getHeight();
|
||||||
// Height is zero when the view is not yet displayed like after orientation change
|
// Height is zero when the view is not yet displayed like after orientation change
|
||||||
if (height != 0) {
|
if (height != 0) {
|
||||||
setHeightThumbnail(height, metrics);
|
setHeightThumbnail(height, metrics);
|
||||||
|
@ -1279,9 +1279,9 @@ public class VideoDetailFragment
|
||||||
requireView().getViewTreeObserver().addOnPreDrawListener(preDrawListener);
|
requireView().getViewTreeObserver().addOnPreDrawListener(preDrawListener);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final int height = isPortrait
|
final int height = (int) (isPortrait
|
||||||
? (int) (metrics.widthPixels / (16.0f / 9.0f))
|
? metrics.widthPixels / (16.0f / 9.0f)
|
||||||
: (int) (metrics.heightPixels / 2.0f);
|
: metrics.heightPixels / 2.0f);
|
||||||
setHeightThumbnail(height, metrics);
|
setHeightThumbnail(height, metrics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,9 +225,9 @@ public final class MainPlayer extends Service {
|
||||||
// DisplayMetrics from activity context knows about MultiWindow feature
|
// DisplayMetrics from activity context knows about MultiWindow feature
|
||||||
// while DisplayMetrics from app context doesn't
|
// while DisplayMetrics from app context doesn't
|
||||||
final DisplayMetrics metrics = (playerImpl != null
|
final DisplayMetrics metrics = (playerImpl != null
|
||||||
&& playerImpl.getParentActivity() != null)
|
&& playerImpl.getParentActivity() != null
|
||||||
? playerImpl.getParentActivity().getResources().getDisplayMetrics()
|
? playerImpl.getParentActivity().getResources()
|
||||||
: getResources().getDisplayMetrics();
|
: getResources()).getDisplayMetrics();
|
||||||
return metrics.heightPixels < metrics.widthPixels;
|
return metrics.heightPixels < metrics.widthPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -748,11 +748,10 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||||
|
|
||||||
//2) Icon change accordingly to current App Theme
|
//2) Icon change accordingly to current App Theme
|
||||||
// using rootView.getContext() because getApplicationContext() didn't work
|
// using rootView.getContext() because getApplicationContext() didn't work
|
||||||
item.setIcon(player.isMuted()
|
item.setIcon(ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
|
||||||
? ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
|
player.isMuted()
|
||||||
R.attr.ic_volume_off)
|
? R.attr.ic_volume_off
|
||||||
: ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
|
: R.attr.ic_volume_up));
|
||||||
R.attr.ic_volume_up));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,12 +84,12 @@ public final class PlayerHelper {
|
||||||
final int days = (milliSeconds % (86400000 * 7)) / 86400000;
|
final int days = (milliSeconds % (86400000 * 7)) / 86400000;
|
||||||
|
|
||||||
STRING_BUILDER.setLength(0);
|
STRING_BUILDER.setLength(0);
|
||||||
return days > 0
|
return (days > 0
|
||||||
? STRING_FORMATTER.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds)
|
? STRING_FORMATTER.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds)
|
||||||
.toString()
|
|
||||||
: hours > 0
|
: hours > 0
|
||||||
? STRING_FORMATTER.format("%d:%02d:%02d", hours, minutes, seconds).toString()
|
? STRING_FORMATTER.format("%d:%02d:%02d", hours, minutes, seconds)
|
||||||
: STRING_FORMATTER.format("%02d:%02d", minutes, seconds).toString();
|
: STRING_FORMATTER.format("%02d:%02d", minutes, seconds)
|
||||||
|
).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatSpeed(final double speed) {
|
public static String formatSpeed(final double speed) {
|
||||||
|
|
|
@ -212,7 +212,7 @@ public class StoredDirectoryHelper {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return docTree == null ? Uri.fromFile(ioTree).toString() : docTree.getUri().toString();
|
return (docTree == null ? Uri.fromFile(ioTree) : docTree.getUri()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -224,9 +224,10 @@ public class MissionsFragment extends Fragment {
|
||||||
mList.setAdapter(mAdapter);
|
mList.setAdapter(mAdapter);
|
||||||
|
|
||||||
if (mSwitch != null) {
|
if (mSwitch != null) {
|
||||||
mSwitch.setIcon(mLinear
|
mSwitch.setIcon(ThemeHelper.resolveResourceIdFromAttr(
|
||||||
? ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_grid)
|
requireContext(), mLinear
|
||||||
: ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_list));
|
? R.attr.ic_grid
|
||||||
|
: R.attr.ic_list));
|
||||||
mSwitch.setTitle(mLinear ? R.string.grid : R.string.list);
|
mSwitch.setTitle(mLinear ? R.string.grid : R.string.list);
|
||||||
mPrefs.edit().putBoolean("linear", mLinear).apply();
|
mPrefs.edit().putBoolean("linear", mLinear).apply();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue