summaryrefslogtreecommitdiff
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2020-08-20 18:36:06 +0200
committerJavier <dev.git@javispedro.com>2020-08-20 18:36:06 +0200
commit4fe050905b367e649ae320110dbacc7686201679 (patch)
tree63dc67d72dc646f43c1a9db4c1ee9384aa754b72 /app/src/main/java/com
parent52aa7ea0653772783f2bb16453e1ad55a915a1d7 (diff)
downloadwallmotion-master.tar.gz
wallmotion-master.zip
improve fab layout behaviorHEADmaster
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/javispedro/wallmotion/Renderer.java3
-rw-r--r--app/src/main/java/com/javispedro/wallmotion/SettingsActivity.java19
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);