diff options
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r-- | app/src/main/java/com/javispedro/wallmotion/Renderer.java | 3 | ||||
-rw-r--r-- | app/src/main/java/com/javispedro/wallmotion/SettingsActivity.java | 19 |
2 files changed, 18 insertions, 4 deletions
diff --git a/app/src/main/java/com/javispedro/wallmotion/Renderer.java b/app/src/main/java/com/javispedro/wallmotion/Renderer.java index 2420277..0b9da5a 100644 --- a/app/src/main/java/com/javispedro/wallmotion/Renderer.java +++ b/app/src/main/java/com/javispedro/wallmotion/Renderer.java @@ -3,6 +3,7 @@ package com.javispedro.wallmotion; import android.content.Context; import android.content.ContextWrapper; import android.content.SharedPreferences; +import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Build; @@ -128,8 +129,8 @@ public class Renderer extends ContextWrapper { player.setOnPreparedListener(listener); player.setOnSeekCompleteListener(listener); player.setLooping(true); + player.setAudioStreamType(AudioManager.STREAM_SYSTEM); player.setVolume(0, 0); - player.setAudioSessionId(0); player.setSurface(surface); Log.d(TAG, "setting data source to " + uri.toString()); player.setDataSource(this, uri); diff --git a/app/src/main/java/com/javispedro/wallmotion/SettingsActivity.java b/app/src/main/java/com/javispedro/wallmotion/SettingsActivity.java index 5fee7df..5e9c5b0 100644 --- a/app/src/main/java/com/javispedro/wallmotion/SettingsActivity.java +++ b/app/src/main/java/com/javispedro/wallmotion/SettingsActivity.java @@ -75,10 +75,8 @@ public class SettingsActivity extends AppCompatActivity { @Override public void onStart() { super.onStart(); - Intent launchIntent = getActivity().getIntent(); - if (launchIntent != null && launchIntent.getAction().equals(ACTION_CHOOSE_FILE)) { + if (isOpenedForVideoFilePicker()) { openVideoFilePicker(); - getActivity().finish(); } } @@ -91,10 +89,25 @@ public class SettingsActivity extends AppCompatActivity { Uri uri = resultData.getData(); setVideoFile(uri); } + if (isOpenedForVideoFilePicker()) { + getActivity().finish(); + } break; } } + private boolean isOpenedForVideoFilePicker() { + Activity activity = getActivity(); + Intent launchIntent = activity.getIntent(); + if (launchIntent != null) { + String launchAction = launchIntent.getAction(); + if (launchAction != null) { + return launchAction.equals(ACTION_CHOOSE_FILE); + } + } + return false; + } + private void openVideoFilePicker() { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); |