Fix a few more deprecations, tiny cleanup (#4388)

This commit is contained in:
Taco 2020-09-29 06:15:40 -04:00 committed by GitHub
parent 61ed58074e
commit 314cc59792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 22 deletions

View File

@ -187,7 +187,7 @@ public class VideoplayerActivity extends MediaplayerActivity {
videoControlsHider.stop();
if (System.currentTimeMillis() - lastScreenTap < 300) {
if (event.getX() > v.getMeasuredWidth() / 2) {
if (event.getX() > v.getMeasuredWidth() / 2.0f) {
onFastForward();
showSkipAnimation(true);
} else {

View File

@ -94,7 +94,7 @@ public class PlaybackControlsDialog extends DialogFragment {
barRightVolume.setEnabled(false);
}
final CheckBox skipSilence = (CheckBox) dialog.findViewById(R.id.skipSilence);
final CheckBox skipSilence = dialog.findViewById(R.id.skipSilence);
skipSilence.setChecked(UserPreferences.isSkipSilence());
if (!UserPreferences.useExoplayer()) {
skipSilence.setEnabled(false);

View File

@ -45,9 +45,8 @@ public class VariableSpeedDialog extends DialogFragment {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.no_playback_plugin_title);
builder.setMessage(R.string.no_playback_plugin_or_sonic_msg);
builder.setPositiveButton(R.string.enable_sonic, (dialog, which) -> {
UserPreferences.enableSonic();
});
builder.setPositiveButton(R.string.enable_sonic, (dialog, which) ->
UserPreferences.enableSonic());
builder.setNeutralButton(R.string.close_label, null);
builder.show();
}

View File

@ -335,10 +335,8 @@ public class QueueFragment extends Fragment {
if (keepSortedNew) {
SortOrder sortOrder = UserPreferences.getQueueKeepSortedOrder();
DBWriter.reorderQueue(sortOrder, true);
if (recyclerAdapter != null) {
recyclerAdapter.updateDragDropEnabled();
}
} else if (recyclerAdapter != null) {
}
if (recyclerAdapter != null) {
recyclerAdapter.updateDragDropEnabled();
}
getActivity().invalidateOptionsMenu();

View File

@ -168,7 +168,7 @@ public class AutoDownloadPreferencesFragment extends PreferenceFragmentCompat {
private void buildEpisodeCleanupPreference() {
final Resources res = getActivity().getResources();
ListPreference pref = (ListPreference) findPreference(UserPreferences.PREF_EPISODE_CLEANUP);
ListPreference pref = findPreference(UserPreferences.PREF_EPISODE_CLEANUP);
String[] values = res.getStringArray(
R.array.episode_cleanup_values);
String[] entries = new String[values.length];

View File

@ -109,7 +109,7 @@ public class PlaybackPreferencesFragment extends PreferenceFragmentCompat {
private void buildSmartMarkAsPlayedPreference() {
final Resources res = getActivity().getResources();
ListPreference pref = (ListPreference) findPreference(UserPreferences.PREF_SMART_MARK_AS_PLAYED_SECS);
ListPreference pref = findPreference(UserPreferences.PREF_SMART_MARK_AS_PLAYED_SECS);
String[] values = res.getStringArray(R.array.smart_mark_as_played_values);
String[] entries = new String[values.length];
for (int x = 0; x < values.length; x++) {

View File

@ -47,11 +47,11 @@ public class LockableBottomSheetBehavior<V extends View> extends ViewPagerBottom
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child, View directTargetChild,
View target, int nestedScrollAxes) {
View target, int axes, int type) {
boolean handled = false;
if (!isLocked) {
handled = super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
handled = super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type);
}
return handled;
@ -59,16 +59,16 @@ public class LockableBottomSheetBehavior<V extends View> extends ViewPagerBottom
@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, V child, View target,
int dx, int dy, int[] consumed) {
int dx, int dy, int[] consumed, int type) {
if (!isLocked) {
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed);
super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
}
}
@Override
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target) {
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target, int type) {
if (!isLocked) {
super.onStopNestedScroll(coordinatorLayout, child, target);
super.onStopNestedScroll(coordinatorLayout, child, target, type);
}
}

View File

@ -290,10 +290,10 @@ public class CustomMRControllerDialog extends MediaRouteControllerDialog {
View playbackControlLayout = View.inflate(getContext(), R.layout.media_router_controller, wrapper);
titleView = (TextView) playbackControlLayout.findViewById(R.id.mrc_control_title);
subtitleView = (TextView) playbackControlLayout.findViewById(R.id.mrc_control_subtitle);
titleView = playbackControlLayout.findViewById(R.id.mrc_control_title);
subtitleView = playbackControlLayout.findViewById(R.id.mrc_control_subtitle);
playbackControlLayout.findViewById(R.id.mrc_control_title_container).setOnClickListener(onClickListener);
playPauseButton = (ImageButton) playbackControlLayout.findViewById(R.id.mrc_control_play_pause);
playPauseButton = playbackControlLayout.findViewById(R.id.mrc_control_play_pause);
playPauseButton.setOnClickListener(v -> {
PlaybackStateCompat state;
if (mediaController != null && (state = mediaController.getPlaybackState()) != null) {

View File

@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.cast;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import androidx.core.view.MenuItemCompat;
import de.danoeh.antennapod.core.R;
public class CastButtonVisibilityManager {
@ -115,6 +115,6 @@ public class CastButtonVisibilityManager {
Log.e(TAG, "setShowAsAction(), but cast button not inflated");
return;
}
MenuItemCompat.setShowAsAction(item, connected ? MenuItem.SHOW_AS_ACTION_ALWAYS : showAsAction);
item.setShowAsAction(connected ? MenuItem.SHOW_AS_ACTION_ALWAYS : showAsAction);
}
}