•  


GitHub - squalle0nhart/MaterialSeekBarPreference: The best yet Implemetation of SeekBarPreference. Works on API-v7 and up.
Skip to content

The best yet Implemetation of SeekBarPreference. Works on API-v7 and up.

Notifications You must be signed in to change notification settings

squalle0nhart/MaterialSeekBarPreference

 
 

Folders and files

Name Name
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MaterialSeekBarPreference

Android Arsenal

As far as I checked, there are no cool implementations of SeekBarPreference. So I decided to make one. Works on API-v7+

#Usage

Add this to your module dependencies:

    compile 
'
com.pavelsikun:material-seekbar-preference:2.3.0+
'

Reference namespace on top of your layout file:

    xmlns:sample="http://schemas.android.com/apk/res-auto">

Now you can use this view in your preferences layout, just like any other normal preference(API-v11+).

    <
com
.pavelsikun.seekbarpreference.SeekBarPreference
        
android
:
key
=
"
your_pref_key
"

        android
:
title
=
"
SeekbarPreference 2
"

        android
:
summary
=
"
Some summary
"

        android
:
enabled
=
"
false
"

        android
:
defaultValue
=
"
5000
"


        sample
:
msbp_minValue
=
"
100
"

        sample
:
msbp_maxValue
=
"
10000
"

        sample
:
msbp_interval
=
"
200
"

        sample
:
msbp_measurementUnit
=
"
%
"

        sample
:
msbp_dialogEnabled
=
"
false
"
/>

If you have to support API-v7+, this lib provides also SeekBarPreferenceCompat that works with preference-v7.

    <
com
.pavelsikun.seekbarpreference.SeekBarPreferenceCompat
        
android
:
key
=
"
your_pref_key
"

        android
:
title
=
"
SeekbarPreference 2
"

        android
:
summary
=
"
Some summary
"

        android
:
enabled
=
"
false
"

        android
:
defaultValue
=
"
5000
"


        sample
:
msbp_minValue
=
"
100
"

        sample
:
msbp_maxValue
=
"
10000
"

        sample
:
msbp_interval
=
"
200
"

        sample
:
msbp_measurementUnit
=
"
%
"

        sample
:
msbp_dialogEnabled
=
"
false
"
/>

Or use MaterialSeekBarView if you prefer to use views instead of preferences(works on v7+):

    <
com
.pavelsikun.seekbarpreference.SeekBarPreferenceView
        
android
:
layout_width
=
"
match_parent
"

        android
:
layout_height
=
"
wrap_content
"


        app
:
msbp_interval
=
"
200
"

        app
:
msbp_maxValue
=
"
0
"

        app
:
msbp_measurementUnit
=
"
bananas
"

        app
:
msbp_minValue
=
"
-2000
"

        sample
:
msbp_dialogEnabled
=
"
false
"


        app
:
msbp_view_title
=
"
SeekBarPreferenceView Example
"

        app
:
msbp_view_summary
=
"
As you can see, view uses a bit different xml-attributes for some things
"

        app
:
msbp_view_enabled
=
"
false
"

        app
:
msbp_view_defaultValue
=
"
0
"
 />

Either of way, View/Preference provides next methods to modify and manage it from Java:

    public
 int
 getMaxValue
();
    
public
 void
 setMaxValue
(
int
 maxValue
);

    
public
 int
 getMinValue
();
    
public
 void
 setMinValue
(
int
 minValue
);

    
public
 String
 getTitle
();
    
public
 void
 setTitle
(
String
 title
);

    
public
 String
 getSummary
();
    
public
 void
 setSummary
(
String
 summary
);

    
public
 boolean
 isEnabled
();
    
public
 void
 setEnabled
(
boolean
 enabled
);

    
public
 int
 getInterval
();
    
public
 void
 setInterval
(
int
 interval
);

    
public
 int
 getCurrentValue
();
    
public
 void
 setCurrentValue
(
int
 currentValue
);

    
public
 String
 getMeasurementUnit
();
    
public
 void
 setMeasurementUnit
(
String
 measurementUnit
);

    
public
 void
 setDialogEnabled
(
boolean
 dialogEnabled
);

    
public
 void
 setDialogStyle
(
int
 dialogStyle
);

    
// AND for view-only(at least for now), there's a way to get a callback whenever value changes:

    public
 void
 setOnValueSelectedListener
(
PersistValueListener
 onValuePersisted
);

As you can see, lib provides 4 universal custom attributes(msbp_minValue, msbp_maxValue, msbp_interval and msbp_measurementUnit).

There are also 4 additional attributes for view bacause it can't use corresponding ones from "android:" (msbp_view_title, msbp_view_summary, msbp_view_enabled and msbp_defaultValue)

Use them to define look and desired behavior.

Prefixes used to avoid attribute collisions with other libs.

Collaborators

I'd really want to thank:

#Licence Lib is licenced under Apache2 licence , so you can do whatever you want with it. I'd highly recommend to push changes back to make it cooler :D

About

The best yet Implemetation of SeekBarPreference. Works on API-v7 and up.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본