Swipper
Android Library for custom views to control brightness , volume and seek through swipable gestures . These views could easily replace the conventional volume / brightness / seek controls that we have in music player ,video player or gallery apps .
Add dependency to build.gradle of your app Dependency
dependencies
{
compile 'com.swipper.library:library:0.1.1'
}
Usage
Extend the activity in which you want to implement by Swipper instead of Activity / AppCompatActivity like:
public class MainActivity extends Swipper{}
Pass the context of your activity in set(context) method in onCreate() of your activity like :
set(this)
Now select swipe options for Brightness/Volume/SeekTo functions , to do this call Brightness() , Volume() , Seek() methods with orientation as parameter in onCreate() of your activity , suppose you want brightness on vertical swipe then do this:
Brightness(Orientation.VERTICAL)
Orientation can also be set to HORIZONTAL for working on horizontal swipe or to CIRCULAR for circular seek bar . Similarily do this for volume too .
Volume(Orientation.CIRCULAR)
Circular custom view appears on double tapping the screen
In seek method you need to pass your VideoView / Mediaplayer object along with orientation parameter , like:
MediaPlayer mediaPlayer=.....
Seek(Orientation.HORIZONTAL,mediaPlayer)
Orientations
Orientation | Description |
---|---|
Orientation.VERTICAL | Associates Brightness/Volume/Seek option on vertical gesture i.e up and down swipe |
Orientation.HORIZONTAL | Associates Brightness/Volume/Seek option on horizontal gesture i.e left and right swipe |
Orientation.CIRCULAR | Associates Brightness or Volume option on circular seek bar |
Other Methods
Method | Role |
---|---|
setColor(String color) | pass hex color to change color of custom view which is by default a shade of orange |
disableBrightness() | to stop working of view associated with brightness |
disableSeek() | to stop working of view associated with Seek |
disableVolume() | to stop working of view associated with Volume |
enableBrightness() | to again start the working of view associated with Brightness |
enableSeek() | to again start the working of view associated with Seek |
enableVolume() | to again start the working of view associated with Volume |
Library is completely exclusive and no external library has been used in making it
License
Copyright 2016 Pulkit Karira
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.