Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
19a871d6
Commit
19a871d6
authored
Aug 12, 2014
by
Edward Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to control audio title alignment
Addresses a potential usability issue Close #11882
parent
479a2896
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
7 deletions
+78
-7
vlc-android/res/values/strings.xml
vlc-android/res/values/strings.xml
+21
-2
vlc-android/res/xml/preferences.xml
vlc-android/res/xml/preferences.xml
+12
-5
vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+8
-0
vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
...c/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+8
-0
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
.../src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
+6
-0
vlc-android/src/org/videolan/vlc/util/Util.java
vlc-android/src/org/videolan/vlc/util/Util.java
+23
-0
No files found.
vlc-android/res/values/strings.xml
View file @
19a871d6
...
...
@@ -228,12 +228,18 @@
<string
name=
"interface_other_category"
>
Interface - Other
</string>
<string
name=
"enable_brightness_gesture"
>
Enable brightness gesture
</string>
<string
name=
"enable_brightness_gesture_summary"
>
Control brightness by gesture during video playback
</string>
<string
name=
"enable_headset_detection"
>
Detect headset
</string>
<string
name=
"enable_headset_detection_summary"
>
Pause on headset removal; resume on headset insertion
</string>
<string
name=
"enable_jump_buttons"
>
Enable jump buttons
</string>
<string
name=
"enable_jump_buttons_summary"
>
Show backward and forward buttons on the video interface
</string>
<string
name=
"audio_title_alignment"
>
Audio title alignment
</string>
<string
name=
"enable_headset_detection"
>
Detect headset
</string>
<string
name=
"enable_headset_detection_summary"
>
Pause on headset removal; resume on headset insertion
</string>
<string
name=
"enable_steal_remote_control"
>
Exclusive headset remote control
</string>
<string
name=
"enable_steal_remote_control_summary"
>
Avoid conflicts by stealing the remote control from other apps. This prevents dialing on double click on HTC phones.
</string>
<string
name=
"audio_title_alignment_default"
>
Default
</string>
<string
name=
"audio_title_alignment_left"
>
Left
</string>
<string
name=
"audio_title_alignment_centre"
>
Centre
</string>
<string
name=
"audio_title_alignment_right"
>
Right
</string>
<string
name=
"audio_title_alignment_marquee"
>
Marquee
</string>
<string
name=
"performance_prefs_category"
>
Performance
</string>
<string
name=
"chroma_format"
>
Force video chroma
</string>
...
...
@@ -333,6 +339,19 @@
<item>
9
</item>
<!-- 9 ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT -->
</string-array>
<string-array
name=
"audio_title_alignment_list"
>
<item>
@string/audio_title_alignment_default
</item>
<item>
@string/audio_title_alignment_left
</item>
<item>
@string/audio_title_alignment_right
</item>
<item>
@string/audio_title_alignment_marquee
</item>
</string-array>
<string-array
name=
"audio_title_alignment_values"
translatable=
"false"
>
<item>
0
</item>
<item>
1
</item>
<item>
2
</item>
<item>
3
</item>
</string-array>
<string-array
name=
"subtitles_encoding_list"
tools:ignore=
"TypographyDashes"
>
<item>
Default (Windows-1252)
</item>
<item>
Universal (UTF-8)
</item>
...
...
vlc-android/res/xml/preferences.xml
View file @
19a871d6
...
...
@@ -57,21 +57,28 @@
android:key=
"enable_brightness_gesture"
android:summary=
"@string/enable_brightness_gesture_summary"
android:title=
"@string/enable_brightness_gesture"
/>
<CheckBoxPreference
android:defaultValue=
"true"
android:key=
"enable_headset_detection"
android:summary=
"@string/enable_headset_detection_summary"
android:title=
"@string/enable_headset_detection"
/>
<CheckBoxPreference
android:defaultValue=
"false"
android:key=
"enable_jump_buttons"
android:summary=
"@string/enable_jump_buttons_summary"
android:title=
"@string/enable_jump_buttons"
/>
<CheckBoxPreference
android:defaultValue=
"true"
android:key=
"enable_headset_detection"
android:summary=
"@string/enable_headset_detection_summary"
android:title=
"@string/enable_headset_detection"
/>
<CheckBoxPreference
android:defaultValue=
"false"
android:key=
"enable_steal_remote_control"
android:summary=
"@string/enable_steal_remote_control_summary"
android:title=
"@string/enable_steal_remote_control"
/>
<ListPreference
android:defaultValue=
"0"
android:entries=
"@array/audio_title_alignment_list"
android:entryValues=
"@array/audio_title_alignment_values"
android:key=
"audio_title_alignment"
android:persistent=
"true"
android:title=
"@string/audio_title_alignment"
/>
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
android:title=
"@string/performance_prefs_category"
>
...
...
vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
View file @
19a871d6
...
...
@@ -34,10 +34,13 @@ import org.videolan.vlc.R;
import
org.videolan.vlc.VLCApplication
;
import
org.videolan.vlc.util.AndroidDevices
;
import
org.videolan.vlc.util.Strings
;
import
org.videolan.vlc.util.Util
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.preference.PreferenceManager
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
...
...
@@ -252,6 +255,8 @@ public class DirectoryAdapter extends BaseAdapter {
private
String
mCurrentDir
;
private
String
mCurrentRoot
;
private
int
mAlignMode
;
// align mode from prefs
public
DirectoryAdapter
(
Context
context
)
{
DirectoryAdapter_Core
(
context
,
null
);
}
...
...
@@ -265,6 +270,8 @@ public class DirectoryAdapter extends BaseAdapter {
mCurrentDir
=
rootDir
;
this
.
populateNode
(
mRootNode
,
rootDir
);
mCurrentNode
=
mRootNode
;
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
activityContext
);
mAlignMode
=
Integer
.
valueOf
(
preferences
.
getString
(
"audio_title_alignment"
,
"0"
));
}
@Override
...
...
@@ -305,6 +312,7 @@ public class DirectoryAdapter extends BaseAdapter {
holder
.
layout
=
v
.
findViewById
(
R
.
id
.
layout_item
);
holder
.
title
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
title
);
holder
.
title
.
setSelected
(
true
);
Util
.
setAlignModeByPref
(
mAlignMode
,
holder
.
title
);
holder
.
text
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
text
);
holder
.
icon
=
(
ImageView
)
v
.
findViewById
(
R
.
id
.
dvi_icon
);
v
.
setTag
(
holder
);
...
...
vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
View file @
19a871d6
...
...
@@ -29,9 +29,12 @@ import java.util.Map;
import
org.videolan.libvlc.Media
;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.util.BitmapCache
;
import
org.videolan.vlc.util.Util
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.graphics.Bitmap
;
import
android.preference.PreferenceManager
;
import
android.util.SparseArray
;
import
android.view.LayoutInflater
;
import
android.view.View
;
...
...
@@ -54,6 +57,8 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
// A list of all the sections in the list; better performance than searching the whole list
private
SparseArray
<
String
>
mSections
;
private
int
mAlignMode
;
// align mode from prefs
private
Context
mContext
;
// The types of the item views: media and separator.
...
...
@@ -93,6 +98,8 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
if
(
itemType
!=
ITEM_WITHOUT_COVER
&&
itemType
!=
ITEM_WITH_COVER
)
throw
new
IllegalArgumentException
();
mItemType
=
itemType
;
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
mAlignMode
=
Integer
.
valueOf
(
preferences
.
getString
(
"audio_title_alignment"
,
"0"
));
}
public
void
add
(
String
title
,
String
subTitle
,
Media
media
)
{
...
...
@@ -233,6 +240,7 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
holder
=
new
ViewHolder
();
holder
.
layout
=
v
.
findViewById
(
R
.
id
.
layout_item
);
holder
.
title
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
title
);
Util
.
setAlignModeByPref
(
mAlignMode
,
holder
.
title
);
holder
.
cover
=
(
ImageView
)
v
.
findViewById
(
R
.
id
.
cover
);
holder
.
subtitle
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
subtitle
);
holder
.
footer
=
v
.
findViewById
(
R
.
id
.
footer
);
...
...
vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
View file @
19a871d6
...
...
@@ -29,7 +29,9 @@ import org.videolan.vlc.util.Util;
import
org.videolan.vlc.widget.AudioPlaylistItemViewGroup
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.res.ColorStateList
;
import
android.preference.PreferenceManager
;
import
android.view.LayoutInflater
;
import
android.view.MotionEvent
;
import
android.view.View
;
...
...
@@ -47,12 +49,15 @@ public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
private
ArrayList
<
Media
>
mMediaList
;
private
int
mCurrentIndex
;
private
Context
mContext
;
private
int
mAlignMode
;
public
AudioPlaylistAdapter
(
Context
context
)
{
super
(
context
,
0
);
mContext
=
context
;
mMediaList
=
new
ArrayList
<
Media
>();
mCurrentIndex
=
-
1
;
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
mAlignMode
=
Integer
.
valueOf
(
preferences
.
getString
(
"audio_title_alignment"
,
"0"
));
}
@Override
...
...
@@ -86,6 +91,7 @@ public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
v
=
inflater
.
inflate
(
R
.
layout
.
audio_playlist_item
,
parent
,
false
);
holder
=
new
ViewHolder
();
holder
.
title
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
title
);
Util
.
setAlignModeByPref
(
mAlignMode
,
holder
.
title
);
holder
.
artist
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
artist
);
holder
.
moveButton
=
(
ImageButton
)
v
.
findViewById
(
R
.
id
.
move
);
holder
.
expansion
=
(
LinearLayout
)
v
.
findViewById
(
R
.
id
.
item_expansion
);
...
...
vlc-android/src/org/videolan/vlc/util/Util.java
View file @
19a871d6
...
...
@@ -29,8 +29,10 @@ import org.videolan.vlc.VLCApplication;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.text.TextUtils.TruncateAt
;
import
android.util.DisplayMetrics
;
import
android.util.TypedValue
;
import
android.widget.TextView
;
import
android.widget.Toast
;
public
class
Util
{
...
...
@@ -86,4 +88,25 @@ public class Util {
a
.
recycle
();
return
resId
;
}
/**
* Set the alignment mode of the specified TextView with the desired align
* mode from preferences.
*
* See @array/audio_title_alignment_values
*
* @param alignMode Align mode as read from preferences
* @param t Reference to the textview
*/
public
static
void
setAlignModeByPref
(
int
alignMode
,
TextView
t
)
{
if
(
alignMode
==
1
)
t
.
setEllipsize
(
TruncateAt
.
END
);
else
if
(
alignMode
==
2
)
t
.
setEllipsize
(
TruncateAt
.
START
);
else
if
(
alignMode
==
3
)
{
t
.
setEllipsize
(
TruncateAt
.
MARQUEE
);
t
.
setMarqueeRepeatLimit
(-
1
);
t
.
setSelected
(
true
);
}
}
}
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