mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove getActivity()
This commit is contained in:
@@ -132,7 +132,6 @@ public class AudioSlidePlayer {
|
||||
@Override
|
||||
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
|
||||
Log.d(TAG, "onPlayerStateChanged(" + playWhenReady + ", " + playbackState + ")");
|
||||
Activity activity;
|
||||
switch (playbackState) {
|
||||
case Player.STATE_READY:
|
||||
|
||||
@@ -293,7 +292,7 @@ public class AudioSlidePlayer {
|
||||
}
|
||||
|
||||
public void keepScreenOn(boolean keepOn) {
|
||||
Activity activity = getActivity(context);
|
||||
Activity activity = (context instanceof Activity)? (Activity) context : null;
|
||||
if (activity != null) {
|
||||
if (keepOn) {
|
||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
@@ -303,13 +302,6 @@ public class AudioSlidePlayer {
|
||||
}
|
||||
}
|
||||
|
||||
private Activity getActivity(Context context) {
|
||||
if (context == null) return null;
|
||||
if (context instanceof Activity) return (Activity) context;
|
||||
if (context instanceof ContextWrapper) return getActivity(((ContextWrapper)context).getBaseContext());
|
||||
return null;
|
||||
}
|
||||
|
||||
private synchronized static void setPlaying(@NonNull AudioSlidePlayer player) {
|
||||
if (playing.isPresent() && playing.get() != player) {
|
||||
playing.get().notifyOnStop();
|
||||
|
||||
Reference in New Issue
Block a user