Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
HoraApps
LeafPic
Commits
428b9a32
Commit
428b9a32
authored
Aug 28, 2018
by
Donald
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '263-feature-request-loop-videos' into 'dev'
Loop videos See merge request
!599
parents
d97232bc
0574011b
Pipeline
#28901986
passed with stage
in 8 minutes and 44 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
8 deletions
+41
-8
app/src/main/java/org/horaapps/leafpic/activities/PlayerActivity.java
.../java/org/horaapps/leafpic/activities/PlayerActivity.java
+20
-7
app/src/main/java/org/horaapps/leafpic/util/preferences/Defaults.java
.../java/org/horaapps/leafpic/util/preferences/Defaults.java
+1
-0
app/src/main/java/org/horaapps/leafpic/util/preferences/Keys.java
...main/java/org/horaapps/leafpic/util/preferences/Keys.java
+1
-0
app/src/main/java/org/horaapps/leafpic/util/preferences/Prefs.java
...ain/java/org/horaapps/leafpic/util/preferences/Prefs.java
+8
-0
app/src/main/res/menu/menu_video_player.xml
app/src/main/res/menu/menu_video_player.xml
+7
-1
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+4
-0
No files found.
app/src/main/java/org/horaapps/leafpic/activities/PlayerActivity.java
View file @
428b9a32
...
...
@@ -81,6 +81,7 @@ import org.horaapps.leafpic.R;
import
org.horaapps.leafpic.activities.base.BaseActivity
;
import
org.horaapps.leafpic.util.Measure
;
import
org.horaapps.leafpic.util.StringUtils
;
import
org.horaapps.leafpic.util.preferences.Prefs
;
import
org.horaapps.leafpic.views.videoplayer.CustomExoPlayerView
;
import
org.horaapps.leafpic.views.videoplayer.CustomPlayBackController
;
import
org.horaapps.leafpic.views.videoplayer.TrackSelectionHelper
;
...
...
@@ -138,11 +139,9 @@ public class PlayerActivity extends BaseActivity implements CustomPlayBackContro
if
(
CookieHandler
.
getDefault
()
!=
DEFAULT_COOKIE_MANAGER
)
{
CookieHandler
.
setDefault
(
DEFAULT_COOKIE_MANAGER
);
}
setContentView
(
R
.
layout
.
activity_player
);
initUi
();
rootView
=
findViewById
(
R
.
id
.
root
);
simpleExoPlayerView
=
findViewById
(
R
.
id
.
player_view
);
simpleExoPlayerView
.
setControllerVisibilityListener
(
this
);
simpleExoPlayerView
.
requestFocus
();
...
...
@@ -234,7 +233,6 @@ public class PlayerActivity extends BaseActivity implements CustomPlayBackContro
String
[]
keyRequestPropertiesArray
=
intent
.
getStringArrayExtra
(
DRM_KEY_REQUEST_PROPERTIES
);
boolean
multiSession
=
intent
.
getBooleanExtra
(
DRM_MULTI_SESSION
,
false
);
int
errorStringId
=
R
.
string
.
error_drm_unknown
;
try
{
drmSessionManager
=
buildDrmSessionManagerV18
(
drmSchemeUuid
,
drmLicenseUrl
,
keyRequestPropertiesArray
,
multiSession
);
...
...
@@ -247,15 +245,17 @@ public class PlayerActivity extends BaseActivity implements CustomPlayBackContro
return
;
}
}
DefaultRenderersFactory
renderersFactory
=
new
DefaultRenderersFactory
(
this
,
drmSessionManager
,
DefaultRenderersFactory
.
EXTENSION_RENDERER_MODE_PREFER
);
player
=
ExoPlayerFactory
.
newSimpleInstance
(
renderersFactory
,
trackSelector
);
player
.
addListener
(
new
PlayerEventListener
());
simpleExoPlayerView
.
setPlayer
(
player
);
player
.
setPlayWhenReady
(
shouldAutoPlay
);
if
(
Prefs
.
getLoopVideo
())
{
player
.
setRepeatMode
(
Player
.
REPEAT_MODE_ALL
);
}
else
{
player
.
setRepeatMode
(
Player
.
REPEAT_MODE_OFF
);
}
}
String
action
=
intent
.
getAction
();
...
...
@@ -442,7 +442,8 @@ public class PlayerActivity extends BaseActivity implements CustomPlayBackContro
}
}
MenuItem
loop
=
menu
.
findItem
(
R
.
id
.
loop_video
);
loop
.
setChecked
(
Prefs
.
getLoopVideo
());
return
true
;
}
...
...
@@ -496,6 +497,18 @@ public class PlayerActivity extends BaseActivity implements CustomPlayBackContro
setRequestedOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
);
}
return
true
;
case
R
.
id
.
loop_video
:
if
(
item
.
isChecked
())
{
item
.
setChecked
(
false
);
Prefs
.
setLoopVideo
(
false
);
player
.
setRepeatMode
(
Player
.
REPEAT_MODE_OFF
);
}
else
{
item
.
setChecked
(
true
);
Prefs
.
setLoopVideo
(
true
);
player
.
setRepeatMode
(
Player
.
REPEAT_MODE_ALL
);
}
return
true
;
default
:
return
super
.
onOptionsItemSelected
(
item
);
...
...
app/src/main/java/org/horaapps/leafpic/util/preferences/Defaults.java
View file @
428b9a32
...
...
@@ -36,4 +36,5 @@ public final class Defaults {
public
static
final
boolean
ANIMATIONS_DISABLED
=
false
;
public
static
final
boolean
TIMELINE_ENABLED
=
false
;
public
static
final
boolean
LOOP_VIDEO
=
false
;
}
app/src/main/java/org/horaapps/leafpic/util/preferences/Keys.java
View file @
428b9a32
...
...
@@ -28,6 +28,7 @@ public final class Keys {
public
static
final
String
ANIMATIONS_DISABLED
=
"disable_animations"
;
public
static
final
String
FORCE_ENGLISH
=
"force_english_locale"
;
public
static
final
String
LOOP_VIDEO
=
"loop_video"
;
// Feature flags
public
static
final
String
TIMELINE_ENABLED
=
"enable_timeline"
;
...
...
app/src/main/java/org/horaapps/leafpic/util/preferences/Prefs.java
View file @
428b9a32
...
...
@@ -234,6 +234,14 @@ public class Prefs {
return
getPrefs
().
get
(
key
,
defaultValue
);
}
public
static
boolean
getLoopVideo
()
{
return
getPrefs
().
get
(
Keys
.
LOOP_VIDEO
,
Defaults
.
LOOP_VIDEO
);
}
public
static
void
setLoopVideo
(
boolean
value
)
{
getPrefs
().
put
(
Keys
.
LOOP_VIDEO
,
value
);
}
// ***** Remove these methods when SettingWithSwitchView is refactored.
@NonNull
...
...
app/src/main/res/menu/menu_video_player.xml
View file @
428b9a32
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
<menu
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/action_share"
...
...
@@ -24,6 +25,11 @@
android:title=
"@string/text"
android:visible=
"false"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/loop_video"
android:title=
"@string/loop_video"
android:checkable=
"true"
app:showAsAction=
"never"
/>
<item
android:id=
"@+id/action_settings"
android:title=
"@string/settings"
...
...
app/src/main/res/values/strings.xml
View file @
428b9a32
...
...
@@ -337,6 +337,7 @@
<string
name=
"text"
>
Text
</string>
<string
name=
"retry"
>
Retry
</string>
<string
name=
"off"
>
Off
</string>
<string
name=
"loop_video"
>
Loop video
</string>
<!--ERRORS-->
<string
name=
"error_drm_not_supported"
>
Protected content is supported on Android 4.3 and later
</string>
...
...
@@ -417,4 +418,7 @@
<string
name=
"timeline_grouping_menu_month"
>
Month
</string>
<string
name=
"timeline_grouping_menu_year"
>
Year
</string>
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment