• Stars
    star
    227
  • Rank 175,900 (Top 4 %)
  • Language
    Kotlin
  • Created about 6 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android library for adding price range with chart like in airbnb with flexible customization. Made by Stfalcon

Stfalcon-PriceRangeBar

Demo Application

Get it on Google Play

Who we are

Need iOS and Android apps, MVP development or prototyping? Contact us via [email protected]. We develop software since 2009, and we're known experts in this field. Check out our portfolio and see more libraries from stfalcon-studio.

Download

  1. Add jitpack to the root build.gradle file of your project at the end of repositories.
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency
dependencies {
  ...
  implementation "com.github.stfalcon-studio:StfalconPriceRangeBar-android:[latest_version]"
}  

Where the latest_version is the value from JitPack.io.

Usage

For adding default seekbar with chart just put this code into your layout:

<com.stfalcon.pricerangebar.SeekBarWithChart
   android:layout_width="match_parent"
   android:layout_height="wrap_content"/>

Or you can use default rangebar with chart just put this code into your layout:

<com.stfalcon.pricerangebar.RangeBarWithChart
   android:layout_width="match_parent"
   android:layout_height="wrap_content"/>

After that you should to add list entries with data to displaying

val barEntrys = ArrayList<BarEntry>()

seekBarEntries.add(BarEntry(30.0f, 5.0f))
seekBarEntries.add(BarEntry(32.0f, 7.0f))
seekBarEntries.add(BarEntry(34.0f, 10.0f))
seekBarEntries.add(BarEntry(36.0f, 11.0f))
seekBarEntries.add(BarEntry(38.0f, 14.0f))
seekBarEntries.add(BarEntry(40.0f, 15.0f))

seekBar.setEntries(barEntrys)

You can use many attributes for more flexibility and convenience of use. Here's the full list:

  • barActiveLineColor - color of selected part of rangebar/seekbar
  • barLineColor - color of unselected part of rangebar/seekbar
  • barThumbColor - color of thumb
  • barActiveThumbColor - color of active radius in thumb
  • barActiveTickRadius - clicked size of thumb
  • barChartSelectedBackgroundColor - background color of selected part of chart
  • barChartSelectedLineColor - color of selected part of top line in chart
  • barChartUnSelectedLineColor - color of unelected part of top line in chart
  • barChartUnselectedBackgroundColor - background color of unelected part of chart

For example:

<com.stfalcon.pricerangebar.SeekBarWithChart
    android:id="@+id/seekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:barActiveLineColor="@android:color/holo_orange_dark"
    app:barActiveThumbColor="@android:color/holo_blue_light"
    app:barActiveTickRadius="@dimen/custom_active_tick_radius"
    app:barChartSelectedBackgroundColor="@android:color/holo_red_dark"
    app:barChartSelectedLineColor="@android:color/holo_green_dark"
    app:barChartUnSelectedLineColor="@android:color/holo_green_light"
    app:barChartUnselectedBackgroundColor="@android:color/holo_red_light"
    app:barLineColor="@android:color/holo_blue_light"/>

If you want to observe any changes in seekbar you should to add callbacks like:

  • onPinPositionChanged
  • onSelectedEntriesSizeChanged
  • onSelectedItemsSizeChanged

If you want to observe any changes in rangebar you should to add callbacks like:

  • onRangeChanged
  • onLeftPinChanged
  • onRightPinChanged
  • onSelectedEntriesSizeChanged
  • onSelectedItemsSizeChanged

Let's take look a small sample for seekbar:

seekBar.onPinPositionChanged = { index, pinValue ->
    println("$pinValue $index")
}
seekBar.onSelectedEntriesSizeChanged = { selectedEntriesSize ->
    println("$selectedEntriesSize column was selected")
}
seekBar.onSelectedItemsSizeChanged = { selectedItemsSize ->
    println("selectedItemsSize elements was selected")
}

And for rangebar:

rangeBar.onRangeChanged = { leftPinValue, rightPinValue ->
    println("$leftPinValue $rightPinValue")
}
rangeBar.onLeftPinChanged = { index, leftPinValue ->
    println("$index $leftPinValue")
}
rangeBar.onRightPinChanged = { index, rightPinValue ->
    println("$index $rightPinValue")
}
rangeBar.onSelectedEntriesSizeChanged = { selectedEntriesSize ->
    println("$selectedEntriesSize column was selected")
}
rangeBar.onSelectedItemsSizeChanged = { selectedItemsSize ->
    println("$selectedItemsSize elements was selected")
}

If you want pre select some values you should use setSelectedEntries method.

For example:

seekBar.setSelectedEntries(30)
seekBar.setSelectedEntries(selectedEntriesSublist)

...
rangeBar.setSelectedEntries(20, 40)
rangeBar.setSelectedEntries(selectedEntriesSublist)

How to use it in Java?

We need init all views and variables

private static final String TAG = "Sample";

private ArrayList<BarEntry> seekBarEntries;
private ArrayList<BarEntry> rangeBarEntries;

private SeekBarWithChart seekBar;
private RangeBarWithChart rangeBar;
private TextView seekBarAreaInfo;
private TextView seekbarAreaValue;
private TextView rangeBarValue;
private TextView rangeBarInfo;

...

seekBar = findViewById(R.id.seekBar);
rangeBar = findViewById(R.id.rangeBar);
seekBarAreaInfo = findViewById(R.id.seekbarAreaInfo);
seekbarAreaValue = findViewById(R.id.seekbarAreaValue);
rangeBarValue = findViewById(R.id.rangeBarValue);
rangeBarInfo = findViewById(R.id.rangeBarInfo);

SeekBar

private void initSeekBar() {
   seekBar.setEntries(seekBarEntries);
   seekBar.setOnPinPositionChanged(this::onPinPositionChanged);
   seekBar.setOnSelectedEntriesSizeChanged(this::onSelectedEntriesSizeChanged);
   seekBar.setOnSelectedItemsSizeChanged(this::onSelectedItemsSizeChanged);

   float perimeter = seekBarEntries.get(seekBarEntries.size() - 1).getX();
   seekbarAreaValue.setText(getString(R.string.formatter_meter, Float.toString(perimeter)));

   int totalSelectedSize = 0;
   for (BarEntry entry : seekBarEntries) {
       totalSelectedSize += entry.getY();


   seekBarAreaInfo.setText(getString(R.string.formatter_elements, Float.toString(totalSelectedSize)));
}

RangeBar

private void initRangeBar() {
   rangeBar.setEntries(rangeBarEntries);
   rangeBar.setOnRangeChanged(this::onRangeChanged);
   rangeBar.setOnLeftPinChanged(this::onLeftPinChanged);
   rangeBar.setOnRightPinChanged(this::onRightPinChanged);
   rangeBar.setOnSelectedEntriesSizeChanged(this::onSelectedRangeEntriesSizeChanged);
   rangeBar.setOnSelectedItemsSizeChanged(this::onRangeSelectedItemsSizeChanged);
   int totalSelectedSize = 0;
   for (BarEntry entry : rangeBarEntries) {
       totalSelectedSize += entry.getY();
   }
   rangeBarInfo.setText(getString(R.string.formatter_elements, Float.toString(totalSelectedSize)));
   rangeBarValue.setText(
           getString(
                   R.string.area_range,
                   Float.toString(rangeBarEntries.get(0).getX()),
                   Float.toString(rangeBarEntries.get(rangeBarEntries.size() - 1).getX())
           )
   );
}

Main callbacks

private Unit onPinPositionChanged(Integer index, String pinValue) {
    seekbarAreaValue.setText(getString(R.string.formatter_meter, pinValue));
    Log.d(TAG, "Index value = " + index);
    return Unit.INSTANCE;
}

private Unit onSelectedEntriesSizeChanged(Integer selectedEntriesSize) {
    Log.d(TAG, "SelectedEntriesSize = " + selectedEntriesSize);
    return Unit.INSTANCE;
}

private Unit onSelectedItemsSizeChanged(Integer selectedItemsSize) {
    seekBarAreaInfo.setText(getString(R.string.formatter_elements_int, selectedItemsSize));
    return Unit.INSTANCE;
}

private Unit onRangeChanged(String leftPinValue, String rightPinValue) {
    rangeBarValue.setText(getString(R.string.area_range, leftPinValue, rightPinValue));
    return Unit.INSTANCE;
}

private Unit onLeftPinChanged(Integer index, String leftPinValue) {
    Log.d(TAG, "index = " + index + " $leftPinValue = " + leftPinValue);
    return Unit.INSTANCE;
}

private Unit onRightPinChanged(Integer index, String rightPinValue) {
    Log.d(TAG, "index = " + index + " rightPinValue = " + rightPinValue);
    return Unit.INSTANCE;
}

private Unit onSelectedRangeEntriesSizeChanged(Integer entriesSize) {
    Log.d(TAG, "Range EntriesSize = " + entriesSize);
    return Unit.INSTANCE;
}

private Unit onRangeSelectedItemsSizeChanged(Integer selectedItemsSize) {
    rangeBarInfo.setText(getString(R.string.formatter_elements, selectedItemsSize.toString()));
    return Unit.INSTANCE;
}

Unit - it is a type from package kotlin.

You can check it from full example on Java.

License

Copyright 2018 stfalcon.com

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.

More Repositories

1

ChatKit

Android library. Flexible components for chat UI implementation with flexible possibilities for styling, customizing and data management. Made by Stfalcon
Java
3,681
star
2

StfalconImageViewer

A simple and customizable Android full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" gestures
Kotlin
1,996
star
3

FrescoImageViewer

Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon
Java
1,812
star
4

SmsVerifyCatcher

Android library for phone number verification feature in your app. Automatically copies verification code from SMS right into the app. Made by Stfalcon
Java
845
star
5

MultiImageView

Android library to display a few images in one ImageView like avatar of group chat. Made by Stfalcon
Kotlin
472
star
6

UniversalPickerDialog

Android dialog with auto generated pickers inside, which depends on count of datasets provided. Made by Stfalcon
Java
138
star
7

ContentManager

Android library for getting photo or video from a device gallery, cloud or camera. Working with samsung devices. Made by Stfalcon
Java
109
star
8

SocialAuthHelper

Easy social network authorization for Android. Supports Facebook, Twitter, Instagram, Google+, Vkontakte. Made by Stfalcon
Java
98
star
9

swipeable-button

Android Swipeable button like in iOS unlock screen. Made by Stfalcon
Kotlin
87
star
10

stf-vue-select

stf vue select - most flexible and customized select
JavaScript
62
star
11

DataBindingExample

Sample project for the https://stfalcon.com/en/blog/post/faster-android-apps-with-databinding blogpost
Java
57
star
12

BottomTabLayout

Simple library for creating bottom tab layout. Made by Stfalcon
Java
48
star
13

code_example

Code example shows how we write our code, style and technology what we use
Java
47
star
14

AndroidMvvmHelper

Base classes for easy MVVM implementation for Android. Made by Stfalcon
Java
36
star
15

StfalconFixturer-android

Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon
Kotlin
29
star
16

uaroads_android

UaRoads is a unique service for road condition monitoring. It provides safety and comfort to drivers. Project goal is to build routes through better roads with surface of higher quality.
Kotlin
25
star
17

AndroidMVVMExample

Sample project for the https://stfalcon.com/en/blog/post/android-mvvm blogpost
Java
23
star
18

opencart-theme_tecart

Tecart is awesome OpenCart template. It's specially designed for electronics, computers, mobile stores. Intuitive navigation. Great colors combination of blue, green and gray. It's compatible with features of default template. All sub pages are carefully customized.
CSS
23
star
19

lost-and-found

Web-service for announcements of lost and found things.
PHP
21
star
20

vue-stories-instagram

Vue
17
star
21

ls-plugin_lsgallery

Плагин «LSGallery» предназначен для создания пользователем альбомов и загрузки в них фотографий. Поддерживает пакетную загрузку фотографий и различные настройки приватности для альбомов. Также позволяет отмечать друзей на фотографиях
PHP
17
star
22

MVPHelper

Base classes for quick and easy implementation of MVP for Android applications.
Kotlin
16
star
23

blog-samples

Samples for articles presented in stfalcon blog
Swift
16
star
24

patrol-android

An Android application for video registration of traffic rules violations. You can use this like video registrator. App`s can automatically send violations to our server.
Java
15
star
25

ls-plugin_banneroid

Плагин для удобного размещения и управлениями баннерами на LiveStreet сайтах. Добавление/редактирование/удаление баннеров. Возможность выбирать дату начала/окончания показов, место отображения и др.
PHP
12
star
26

ApiBundle

📦 Base classes and helper services to build API application via Symfony.
PHP
11
star
27

ls-theme_street-spirit

Яркая, в меру строгая и минималистичная тема для LiveStreet. Отличная замена стандартному шаблону.
Smarty
11
star
28

SocialToolKit

Easy social network authorization for iOS. Supports Facebook, Vkontakte and Instagramm
Swift
10
star
29

stfalcon-vue-di

Lightweight dependency injection library for Vue.js
JavaScript
10
star
30

ls-plugin_l10n

Плагин для реализации мультиязычности на LiveStreet сайте. Возможность выбора языка интерфейса при регистрации пользователя и его последующая смена в настройках профиля. Возможность создавать переводы для блогов и топиков.
PHP
10
star
31

staginator

Easily creation of staging environments
HTML
8
star
32

ls-plugin_sitemap

С помощью файла Sitemap веб-мастеры могут сообщать поисковым системам о веб-страницах, которые доступны для сканирования
PHP
7
star
33

patrol

Source code of http://патруль.com/
PHP
6
star
34

uaroads_ios

UaRoads is a unique service for road condition monitoring. It provides safety and comfort to drivers. Project goal is to build routes through better roads with surface of higher quality.
Swift
6
star
35

SwaggerBundle

📦 Creates a Swagger-ui page in Symfony application.
PHP
6
star
36

ls-plugin_seo

Основное предназначение плагина это автоматическая генерация мета тегов keywords и description в зависимости от контента страницы (это положительно влияет на индексацию сайта поисковыми системами и ранжирование их выдачи)
PHP
6
star
37

ls-plugin_debugtoolbar

Предназначен для вывода технической информации о работе сайта на LiveStreet
JavaScript
5
star
38

ls-plugin_similar

Выводит список похожих записей как блок в сайдбаре. Записи сортирует по количеству совпавших тегов и дате/рейтингу.
PHP
5
star
39

ls-plugin_greeting

Плагин предназначен для рассылки приветсвий новым пользователя в LiveStreet CMS. Например, в тексте сообщения можно благодарить пользователя за регистрацию и дать ему ссылки на страницу помощи или общих вопросов по работе с сайтом
PHP
5
star
40

ls-plugin_mailing

Плагин для рассылок сообщений на LiveStreet сайтах с большим количеством пользователей. Есть возможность фильтра получателей по свойству «Пол» («мужчины», «женщины», «не указан») и по свойству «Язык» (интеграция с плагином «L10n»). Можно посмотреть список рассылок и статус хода рассылки
PHP
5
star
41

codedill

Web service for creating study tasks for developers and evaluating solutions anonymously.
PHP
5
star
42

ls-plugin_lsdigest

Плагин предназначен для рассылки дайджестов лучших записей за определенное время. Для работы плагина требуется плагин рассылок "Mailing"
PHP
5
star
43

DoctrineRedisCacheBundle

📦 Add custom namespace for doctrine cache pools.
PHP
4
star
44

zabbix-unifi-video

Zabbix monitoring for Unifi Video
Ruby
4
star
45

StfalconFixturer-ios

Utility for developers and QAs what helps minimize time wasting on writing the same data for testing over and over again. Made by Stfalcon
Swift
4
star
46

captainfailure

Distributed monitoring system.
Ruby
4
star
47

AbTestBundle

PHP
4
star
48

uaroads_wp

Windows Phone application for uaroads.com
C#
4
star
49

ls-plugin_treeblogs

LiveStreet plugin. Tree blogs
PHP
4
star
50

android-simple-weather

Java
3
star
51

ls-plugin_topicextend

LiveStreet plugin. Предназначен для расширения функционала создания топика
PHP
3
star
52

vue-bankid-se

JavaScript
3
star
53

wp-theme_snowberry

Simple and clean wordpress theme with nice contrast headers. Good readability of text. Perfect theme for personal blogs. Based on HTML of Twenty Eleven
PHP
3
star
54

patrol-ios

An iOS application for video registration of traffic rules violations. You can use this like video registrator. App`s can automatically send violations to our server.
Objective-C
3
star
55

ukrainealarm-python-client

Python
3
star
56

StfalconContentPicker

Swift
3
star
57

SwiftExtensions

SwiftExtension is a bunch of useful extension, that we are using at Stfalcon
Swift
3
star
58

world-sights

PHP
3
star
59

lost-and-found-android

Android application for Web-service "Lost and Found"
Java
3
star
60

rock-events

PHP
3
star
61

android_unlocker-3d

Анлокер для Android, который позволяет разблокировать девайс при помощи ранее записанного жеста
Java
3
star
62

ls-plugin_openidcmt

При отправке комментария гость увидит всплывающее окошко авторизации/регистрации, а после авторизации/регистрации его комментарий появится на сайте. Плагин может работать совместно с плагином OpenId (что удобней для гостей сайта) или без него.
PHP
3
star
63

stfalcon-vuex-loading-plugin

JavaScript
2
star
64

stf-angular-select

TypeScript
2
star
65

opencart-plugin_easy-export-import

OpenCart plugin for easy export and import of goods
PHP
2
star
66

android_organizer

Java
2
star
67

android_mtproto-vk-challenge

Приложение для первого тура Durov's Android Challenge
Java
2
star
68

brain-warm-up_v1-game

PHP
2
star
69

sphinxsearch-docker

Puppet
2
star
70

stfalcon-studio.github.io

Websit for stfalcon projects, hosted directly from GitHub repository
HTML
2
star
71

GoogleAwarenessDemo

Kotlin
2
star
72

ls-plugin_usewatermark

Плагин дает пользователю возможность выбора накладывать на загружаемое изображение водяной знак или нет. Также плагин может делать бекап оригиналов закачиваемых изображений до накладывания водяного знака (на случай если вы захотите отказаться от водяных знаков)
PHP
2
star
73

stf-input-list-filter

JavaScript
1
star
74

SonataTranslationBundle

PHP
1
star
75

brain-warm-up_v2-crossword

Algorithmic task in the way of a game. Correct solutions are checked by the automatic unit tests
PHP
1
star
76

android_template_project

Kotlin
1
star
77

dng2jpg

Конвертер графических файлов из формата DNG в формат JPEG
C++
1
star
78

stf-ng-select

The most flexible, reusable and customise select
TypeScript
1
star
79

magento-theme_metriksq

Free Magento theme
1
star
80

ls-plugin_gallery2lsgallery-convertor

Плагин для конвертации данных из старого плагина галереии (от extravert) в фортам LSGallery.
PHP
1
star
81

ls-plugin_lssettings

PHP
1
star
82

YouTubeLikeFeed

Kotlin
1
star