Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
1bd4ff3b
Commit
1bd4ff3b
authored
May 09, 2018
by
Jos
Committed by
Jeffrey Schiller
May 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #1119, thumb shows as a transparent block when deactivated in Lollipop+ (#1197)
parent
4467771c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
appinventor/components/src/com/google/appinventor/components/runtime/Slider.java
...src/com/google/appinventor/components/runtime/Slider.java
+12
-10
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/Slider.java
View file @
1bd4ff3b
...
...
@@ -5,6 +5,7 @@ import android.graphics.PorterDuff;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.LayerDrawable
;
import
android.util.Log
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.widget.SeekBar
;
...
...
@@ -96,6 +97,10 @@ public class Slider extends AndroidViewComponent implements SeekBar.OnSeekBarCha
super
(
container
);
seekbar
=
new
SeekBar
(
container
.
$context
());
if
(
SdkLevel
.
getLevel
()
>=
SdkLevel
.
LEVEL_LOLLIPOP
)
{
seekbar
.
setSplitTrack
(
false
);
}
fullBar
=
(
LayerDrawable
)
seekbar
.
getProgressDrawable
();
beforeThumb
=
fullBar
.
findDrawableByLayerId
(
R
.
id
.
progress
);
...
...
@@ -142,15 +147,6 @@ public class Slider extends AndroidViewComponent implements SeekBar.OnSeekBarCha
beforeThumb
.
setColorFilter
(
leftColor
,
PorterDuff
.
Mode
.
SRC
);
}
/**
* Given min, max, thumb position, this method determines where the thumb position would be
* within normal SeekBar 0-100 range
*
* @param min value for slider
* @param max value for slider
* @param thumb the slider thumb position
*/
// Set the seekbar position based on minValue, maxValue, and thumbPosition
// seekbar position is an integer in the range [0,100] and is determined by MinValue,
// MaxValue and ThumbPosition
...
...
@@ -181,8 +177,14 @@ public class Slider extends AndroidViewComponent implements SeekBar.OnSeekBarCha
if
(
referenceGetThumb
)
{
new
SeekBarHelper
().
getThumb
(
alpha
);
}
seekbar
.
setEnabled
(
thumbEnabled
);
// The Seekbar will respond to touch without the thumb. Consume the event with thumb disabled.
seekbar
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
@Override
public
boolean
onTouch
(
View
view
,
MotionEvent
motionEvent
)
{
return
!
thumbEnabled
;
}
});
}
/**
...
...
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