1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 00:50:32 +00:00

Use AppCompatResources instead of ContextCompat

This commit is contained in:
Stypox 2020-04-02 08:25:47 +02:00
parent 883bcc735d
commit e3e2028153
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
3 changed files with 11 additions and 13 deletions

View File

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -35,6 +36,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
@ -1076,7 +1078,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
return; return;
} }
thumbnailImageView.setImageDrawable(ContextCompat.getDrawable(activity, imageResource)); thumbnailImageView.setImageDrawable(AppCompatResources.getDrawable(requireContext(), imageResource));
animateView(thumbnailImageView, false, 0, 0, animateView(thumbnailImageView, false, 0, 0,
() -> animateView(thumbnailImageView, true, 500)); () -> animateView(thumbnailImageView, true, 500));
} }
@ -1168,8 +1170,9 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
uploaderThumb.setVisibility(View.GONE); uploaderThumb.setVisibility(View.GONE);
} }
subChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); Drawable buddyDrawable = AppCompatResources.getDrawable(activity, R.drawable.buddy);
uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); subChannelThumb.setImageDrawable(buddyDrawable);
uploaderThumb.setImageDrawable(buddyDrawable);
if (info.getViewCount() >= 0) { if (info.getViewCount() >= 0) {
if (info.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) { if (info.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) {

View File

@ -46,7 +46,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.appcompat.content.res.AppCompatResources;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
@ -956,7 +956,7 @@ public abstract class VideoPlayer extends BasePlayer
controlAnimationView.setVisibility(View.VISIBLE); controlAnimationView.setVisibility(View.VISIBLE);
controlAnimationView.setImageDrawable(ContextCompat.getDrawable(context, drawableId)); controlAnimationView.setImageDrawable(AppCompatResources.getDrawable(context, drawableId));
controlViewAnimator.start(); controlViewAnimator.start();
} }

View File

@ -10,7 +10,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.appcompat.content.res.AppCompatResources;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -160,13 +160,8 @@ public class SelectKioskFragment extends DialogFragment {
final Entry entry = kioskList.get(position); final Entry entry = kioskList.get(position);
holder.titleView.setText(entry.kioskName); holder.titleView.setText(entry.kioskName);
holder.thumbnailView holder.thumbnailView
.setImageDrawable(ContextCompat.getDrawable(getContext(), entry.icon)); .setImageDrawable(AppCompatResources.getDrawable(requireContext(), entry.icon));
holder.view.setOnClickListener(new View.OnClickListener() { holder.view.setOnClickListener(view -> clickedItem(entry));
@Override
public void onClick(final View view) {
clickedItem(entry);
}
});
} }
class Entry { class Entry {