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
Casanowow Life for love
VLC-Android
Commits
a0cd36e8
Commit
a0cd36e8
authored
Feb 24, 2014
by
Adrien Maglo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Util: add a function to get a resource id from an attribute id
parent
9dfb69bf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
10 deletions
+19
-10
vlc-android/src/org/videolan/vlc/Util.java
vlc-android/src/org/videolan/vlc/Util.java
+14
-0
vlc-android/src/org/videolan/vlc/gui/expandable/JumpToTime.java
...droid/src/org/videolan/vlc/gui/expandable/JumpToTime.java
+2
-1
vlc-android/src/org/videolan/vlc/gui/expandable/SpeedSelector.java
...id/src/org/videolan/vlc/gui/expandable/SpeedSelector.java
+1
-1
vlc-android/src/org/videolan/vlc/gui/expandable/TimeSleep.java
...ndroid/src/org/videolan/vlc/gui/expandable/TimeSleep.java
+2
-1
vlc-android/src/org/videolan/vlc/widget/ExpandableLayout.java
...android/src/org/videolan/vlc/widget/ExpandableLayout.java
+0
-7
No files found.
vlc-android/src/org/videolan/vlc/Util.java
View file @
a0cd36e8
...
...
@@ -47,6 +47,7 @@ import org.videolan.libvlc.Media;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences.Editor
;
import
android.content.res.TypedArray
;
import
android.database.sqlite.SQLiteFullException
;
import
android.graphics.Bitmap
;
import
android.os.Environment
;
...
...
@@ -541,4 +542,17 @@ public class Util {
public
static
boolean
nullEquals
(
String
s1
,
String
s2
)
{
return
(
s1
==
null
?
s2
==
null
:
s1
.
equals
(
s2
));
}
/**
* Get a resource id from an attribute id.
* @param context
* @param attrId
* @return the resource id
*/
public
static
int
getResourceFromAttribute
(
Context
context
,
int
attrId
)
{
TypedArray
a
=
context
.
getTheme
().
obtainStyledAttributes
(
new
int
[]
{
attrId
});
int
resId
=
a
.
getResourceId
(
0
,
0
);
a
.
recycle
();
return
resId
;
}
}
vlc-android/src/org/videolan/vlc/gui/expandable/JumpToTime.java
View file @
a0cd36e8
...
...
@@ -29,6 +29,7 @@ import kankan.wheel.widget.adapters.NumericWheelAdapter;
import
org.videolan.libvlc.LibVLC
;
import
org.videolan.vlc.AudioServiceController
;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.Util
;
import
org.videolan.vlc.widget.ExpandableLayout
;
import
android.content.Context
;
...
...
@@ -46,7 +47,7 @@ public class JumpToTime extends ExpandableLayout {
public
JumpToTime
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
setTitle
(
R
.
string
.
jump_to_time
);
setIconAttribute
(
R
.
attr
.
ic_jumpto_normal_style
);
setIcon
(
Util
.
getResourceFrom
Attribute
(
context
,
R
.
attr
.
ic_jumpto_normal_style
)
)
;
setContent
(
context
,
R
.
layout
.
expandable_jump_to_time
);
mHourWheel
=
(
WheelView
)
findViewById
(
R
.
id
.
hour
);
...
...
vlc-android/src/org/videolan/vlc/gui/expandable/SpeedSelector.java
View file @
a0cd36e8
...
...
@@ -40,7 +40,7 @@ public class SpeedSelector extends ExpandableLayout {
public
SpeedSelector
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
setTitle
(
R
.
string
.
playback_speed
);
setIconAttribute
(
R
.
attr
.
ic_speed_normal_style
);
setIcon
(
Util
.
getResourceFrom
Attribute
(
context
,
R
.
attr
.
ic_speed_normal_style
)
)
;
setContent
(
context
,
R
.
layout
.
expandable_speed_selector
);
mSeekbar
=
(
SeekBar
)
findViewById
(
R
.
id
.
speed_seek_bar
);
...
...
vlc-android/src/org/videolan/vlc/gui/expandable/TimeSleep.java
View file @
a0cd36e8
...
...
@@ -26,6 +26,7 @@ import kankan.wheel.widget.WheelView;
import
kankan.wheel.widget.adapters.NumericWheelAdapter
;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.Util
;
import
org.videolan.vlc.VLCApplication
;
import
org.videolan.vlc.widget.ExpandableLayout
;
...
...
@@ -49,7 +50,7 @@ public class TimeSleep extends ExpandableLayout {
public
TimeSleep
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
setTitle
(
R
.
string
.
sleep_title
);
setIconAttribute
(
R
.
attr
.
ic_sleep_normal_style
);
setIcon
(
Util
.
getResourceFrom
Attribute
(
context
,
R
.
attr
.
ic_sleep_normal_style
)
)
;
setContent
(
context
,
R
.
layout
.
expandable_time_sleep
);
mHourWheel
=
(
WheelView
)
findViewById
(
R
.
id
.
hour
);
...
...
vlc-android/src/org/videolan/vlc/widget/ExpandableLayout.java
View file @
a0cd36e8
...
...
@@ -88,13 +88,6 @@ public class ExpandableLayout extends LinearLayout {
mIcon
.
setVisibility
(
View
.
VISIBLE
);
}
public
void
setIconAttribute
(
int
attrid
)
{
TypedArray
a
=
mContext
.
getTheme
().
obtainStyledAttributes
(
new
int
[]
{
attrid
});
int
resId
=
a
.
getResourceId
(
0
,
0
);
a
.
recycle
();
setIcon
(
resId
);
}
public
void
setContent
(
Context
context
,
int
resid
)
{
View
view
=
LayoutInflater
.
from
(
context
).
inflate
(
resid
,
null
,
true
);
mContent
.
addView
(
view
);
...
...
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