Push conditionals inside branch expressions
This commit is contained in:
parent
6909d1e527
commit
31cffa68c5
7 changed files with 26 additions and 26 deletions
|
|
@ -225,9 +225,9 @@ public final class MainPlayer extends Service {
|
|||
// DisplayMetrics from activity context knows about MultiWindow feature
|
||||
// while DisplayMetrics from app context doesn't
|
||||
final DisplayMetrics metrics = (playerImpl != null
|
||||
&& playerImpl.getParentActivity() != null)
|
||||
? playerImpl.getParentActivity().getResources().getDisplayMetrics()
|
||||
: getResources().getDisplayMetrics();
|
||||
&& playerImpl.getParentActivity() != null
|
||||
? playerImpl.getParentActivity().getResources()
|
||||
: getResources()).getDisplayMetrics();
|
||||
return metrics.heightPixels < metrics.widthPixels;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -748,11 +748,10 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
|||
|
||||
//2) Icon change accordingly to current App Theme
|
||||
// using rootView.getContext() because getApplicationContext() didn't work
|
||||
item.setIcon(player.isMuted()
|
||||
? ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
|
||||
R.attr.ic_volume_off)
|
||||
: ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
|
||||
R.attr.ic_volume_up));
|
||||
item.setIcon(ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
|
||||
player.isMuted()
|
||||
? R.attr.ic_volume_off
|
||||
: R.attr.ic_volume_up));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,12 +84,12 @@ public final class PlayerHelper {
|
|||
final int days = (milliSeconds % (86400000 * 7)) / 86400000;
|
||||
|
||||
STRING_BUILDER.setLength(0);
|
||||
return days > 0
|
||||
return (days > 0
|
||||
? STRING_FORMATTER.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds)
|
||||
.toString()
|
||||
: hours > 0
|
||||
? STRING_FORMATTER.format("%d:%02d:%02d", hours, minutes, seconds).toString()
|
||||
: STRING_FORMATTER.format("%02d:%02d", minutes, seconds).toString();
|
||||
? STRING_FORMATTER.format("%d:%02d:%02d", hours, minutes, seconds)
|
||||
: STRING_FORMATTER.format("%02d:%02d", minutes, seconds)
|
||||
).toString();
|
||||
}
|
||||
|
||||
public static String formatSpeed(final double speed) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue