Fix some deprecations
This commit is contained in:
parent
ba6c7de35a
commit
a4feb3fc09
|
@ -187,7 +187,6 @@ dependencies {
|
||||||
|
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata:${androidxLifecycleVersion}"
|
implementation "androidx.lifecycle:lifecycle-livedata:${androidxLifecycleVersion}"
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel:${androidxLifecycleVersion}"
|
implementation "androidx.lifecycle:lifecycle-viewmodel:${androidxLifecycleVersion}"
|
||||||
implementation "androidx.lifecycle:lifecycle-extensions:${androidxLifecycleVersion}"
|
|
||||||
|
|
||||||
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
|
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
|
||||||
implementation "androidx.room:room-rxjava2:${androidxRoomVersion}"
|
implementation "androidx.room:room-rxjava2:${androidxRoomVersion}"
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.schabi.newpipe.report;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import androidx.test.filters.LargeTest;
|
import androidx.test.filters.LargeTest;
|
||||||
|
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class AboutActivity extends AppCompatActivity {
|
||||||
*/
|
*/
|
||||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||||
public SectionsPagerAdapter(final FragmentManager fm) {
|
public SectionsPagerAdapter(final FragmentManager fm) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,13 +14,13 @@ import io.reactivex.Flowable;
|
||||||
@Dao
|
@Dao
|
||||||
public interface BasicDAO<Entity> {
|
public interface BasicDAO<Entity> {
|
||||||
/* Inserts */
|
/* Inserts */
|
||||||
@Insert(onConflict = OnConflictStrategy.FAIL)
|
@Insert(onConflict = OnConflictStrategy.ABORT)
|
||||||
long insert(Entity entity);
|
long insert(Entity entity);
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.FAIL)
|
@Insert(onConflict = OnConflictStrategy.ABORT)
|
||||||
List<Long> insertAll(Entity... entities);
|
List<Long> insertAll(Entity... entities);
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.FAIL)
|
@Insert(onConflict = OnConflictStrategy.ABORT)
|
||||||
List<Long> insertAll(Collection<Entity> entities);
|
List<Long> insertAll(Collection<Entity> entities);
|
||||||
|
|
||||||
/* Searches */
|
/* Searches */
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.schabi.newpipe.download;
|
package org.schabi.newpipe.download;
|
||||||
|
|
||||||
import android.app.FragmentTransaction;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -11,6 +10,7 @@ import android.view.ViewTreeObserver;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.util.DeviceUtils;
|
import org.schabi.newpipe.util.DeviceUtils;
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class TabAdaptor extends FragmentPagerAdapter {
|
||||||
private final FragmentManager fragmentManager;
|
private final FragmentManager fragmentManager;
|
||||||
|
|
||||||
public TabAdaptor(final FragmentManager fm) {
|
public TabAdaptor(final FragmentManager fm) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
this.fragmentManager = fm;
|
this.fragmentManager = fm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModelProviders
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import icepick.State
|
import icepick.State
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
@ -82,7 +82,7 @@ class FeedFragment : BaseListFragment<FeedState, Unit>() {
|
||||||
override fun onViewCreated(rootView: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(rootView: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(rootView, savedInstanceState)
|
super.onViewCreated(rootView, savedInstanceState)
|
||||||
|
|
||||||
viewModel = ViewModelProviders.of(this, FeedViewModel.Factory(requireContext(), groupId)).get(FeedViewModel::class.java)
|
viewModel = ViewModelProvider(this, FeedViewModel.Factory(requireContext(), groupId)).get(FeedViewModel::class.java)
|
||||||
viewModel.stateLiveData.observe(viewLifecycleOwner, Observer { it?.let(::handleResult) })
|
viewModel.stateLiveData.observe(viewLifecycleOwner, Observer { it?.let(::handleResult) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import android.view.MenuInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.lifecycle.ViewModelProviders
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
@ -277,7 +277,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
||||||
}
|
}
|
||||||
items_list.adapter = groupAdapter
|
items_list.adapter = groupAdapter
|
||||||
|
|
||||||
viewModel = ViewModelProviders.of(this).get(SubscriptionViewModel::class.java)
|
viewModel = ViewModelProvider(this).get(SubscriptionViewModel::class.java)
|
||||||
viewModel.stateLiveData.observe(viewLifecycleOwner, androidx.lifecycle.Observer { it?.let(this::handleResult) })
|
viewModel.stateLiveData.observe(viewLifecycleOwner, androidx.lifecycle.Observer { it?.let(this::handleResult) })
|
||||||
viewModel.feedGroupsLiveData.observe(viewLifecycleOwner, androidx.lifecycle.Observer { it?.let(this::handleFeedGroups) })
|
viewModel.feedGroupsLiveData.observe(viewLifecycleOwner, androidx.lifecycle.Observer { it?.let(this::handleFeedGroups) })
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModelProviders
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper
|
import androidx.recyclerview.widget.ItemTouchHelper
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper.SimpleCallback
|
import androidx.recyclerview.widget.ItemTouchHelper.SimpleCallback
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -49,7 +49,7 @@ class FeedGroupReorderDialog : DialogFragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
viewModel = ViewModelProviders.of(this).get(FeedGroupReorderDialogViewModel::class.java)
|
viewModel = ViewModelProvider(this).get(FeedGroupReorderDialogViewModel::class.java)
|
||||||
viewModel.groupsLiveData.observe(viewLifecycleOwner, Observer(::handleGroups))
|
viewModel.groupsLiveData.observe(viewLifecycleOwner, Observer(::handleGroups))
|
||||||
viewModel.dialogEventLiveData.observe(viewLifecycleOwner, Observer {
|
viewModel.dialogEventLiveData.observe(viewLifecycleOwner, Observer {
|
||||||
when (it) {
|
when (it) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
@ -210,18 +211,18 @@ public abstract class VideoPlayer extends BasePlayer
|
||||||
|
|
||||||
this.captionTextView = view.findViewById(R.id.captionTextView);
|
this.captionTextView = view.findViewById(R.id.captionTextView);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
playbackSeekBar.getThumb()
|
||||||
playbackSeekBar.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
|
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
|
||||||
}
|
this.playbackSeekBar.getProgressDrawable()
|
||||||
this.playbackSeekBar.getProgressDrawable().
|
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY));
|
||||||
setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY);
|
|
||||||
|
|
||||||
this.qualityPopupMenu = new PopupMenu(context, qualityTextView);
|
this.qualityPopupMenu = new PopupMenu(context, qualityTextView);
|
||||||
this.playbackSpeedPopupMenu = new PopupMenu(context, playbackSpeedTextView);
|
this.playbackSpeedPopupMenu = new PopupMenu(context, playbackSpeedTextView);
|
||||||
this.captionPopupMenu = new PopupMenu(context, captionTextView);
|
this.captionPopupMenu = new PopupMenu(context, captionTextView);
|
||||||
|
|
||||||
((ProgressBar) this.loadingPanel.findViewById(R.id.progressBarLoadingPanel))
|
((ProgressBar) this.loadingPanel.findViewById(R.id.progressBarLoadingPanel))
|
||||||
.getIndeterminateDrawable().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY);
|
.getIndeterminateDrawable()
|
||||||
|
.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void setupSubtitleView(@NonNull SubtitleView view, float captionScale,
|
protected abstract void setupSubtitleView(@NonNull SubtitleView view, float captionScale,
|
||||||
|
@ -456,11 +457,8 @@ public abstract class VideoPlayer extends BasePlayer
|
||||||
animateView(controlsRoot, false, DEFAULT_CONTROLS_DURATION);
|
animateView(controlsRoot, false, DEFAULT_CONTROLS_DURATION);
|
||||||
|
|
||||||
playbackSeekBar.setEnabled(false);
|
playbackSeekBar.setEnabled(false);
|
||||||
// Bug on lower api, disabling and enabling the seekBar resets the thumb color -.-,
|
playbackSeekBar.getThumb()
|
||||||
// so sets the color again
|
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
playbackSeekBar.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
loadingPanel.setBackgroundColor(Color.BLACK);
|
loadingPanel.setBackgroundColor(Color.BLACK);
|
||||||
animateView(loadingPanel, true, 0);
|
animateView(loadingPanel, true, 0);
|
||||||
|
@ -476,11 +474,8 @@ public abstract class VideoPlayer extends BasePlayer
|
||||||
showAndAnimateControl(-1, true);
|
showAndAnimateControl(-1, true);
|
||||||
|
|
||||||
playbackSeekBar.setEnabled(true);
|
playbackSeekBar.setEnabled(true);
|
||||||
// Bug on lower api, disabling and enabling the seekBar resets the thumb color -.-,
|
playbackSeekBar.getThumb()
|
||||||
// so sets the color again
|
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
playbackSeekBar.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
loadingPanel.setVisibility(View.GONE);
|
loadingPanel.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue