GithubHelp home page GithubHelp logo

faramarzaf / valueselector Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 4.08 MB

This is an Android library that provides different customization attributes and easy value selection for every states that you want.

Java 100.00%
value selector android git github library libraries android-application android-studio android-library

valueselector's Introduction

API

ValueSelector

Value Selector is an Android library for value selection in any state that you want with easy usage.

  • Customizable
    • color
    • fonts
      • Also supports not-latin fonts like Persian, Arabic,etc.
    • size
    • thickness
    • border, etc
  • Horizontal and Vertical orientation are supported
  • Build in AndroidX

โ— Note: Place your custom fonts in assets folder to access customFontFamily attr.

Usage

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  

Step 2. Add the dependency

	dependencies {
	  implementation 'com.github.faramarzaf:ValueSelector:1.0.9'
	}

In your XML Layout

<com.faramarz.tictacdev.mycustomcounter.ValueSelector
						      android:id="@+id/value_selector"
						      android:layout_width="wrap_content"
						      android:layout_height="wrap_content"
						      app:borderColor="#5C96CE"
						      app:borderRadius="10"
						      app:borderThickness="8"
						      app:gapValue="1"
						      app:invertIconsPlace="True"
						      app:maxValue="100"
						      app:minValue="-100"
						      app:minusBtnColor="#1E88E5"
						      app:minusIconHeightSize="25dp"
						      app:minusIconWidthSize="25dp"
						      app:plusBtnColor="#D81B60"
						      app:plusIconHeightSize="25dp"
						      app:plusIconWidthSize="25dp"
						      app:startValue="5"
						      app:updateInterval="100"
						      app:valueColor="#FB8C00"
						      app:valueSelectorOrientation="horizontal"
						      app:valueTextSize="8sp"
						      app:valueSelectorFontFamily="sans_serif"
						      app:customFontFamily="your_font.ttf"
						      app:iconTypes="circle"
        />
N.o Attributes Description N.o Attributes Description
1 borderColor The color of layout border 12 plusBtnColor The color of + icon
2 borderRadius The radius of layout border 13 plusIconHeightSize The height of + icon
3 borderThickness The thickness of layout border 14 plusIconWidthSize The width of + icon
4 gapValue The distance between the values 15 startValue The number that value selector starts work from that
5 invertIconsPlace The place of + & - will be change by True/False 16 updateInterval The time that value changes by long press on plus or minus
6 maxValue The max value that you can select 17 valueColor The color of value that you choose
7 minValue The min value that you can select 18 valueSelectorOrientation Vertical or horizontal layout orientation
8 minusBtnColor The color of - icon 19 valueTextSize The text size of value that you select
9 minusIconHeightSize The height of - icon 20 valueSelectorFontFamily Three default fonts: sans_serif, sans and monospace(Without assets fonts)
10 minusIconWidthSize The width of - icon 21 customFontFamily The font that you have in assets folder
11 iconTypes Choose between these types plus_minus , arrow , expand , circle 22 - -

Java usage

valueSelector.setCustomFont(this,"your_font.ttf");
valueSelector.setValue(25);
valueSelector.setMaxValue(40);
valueSelector.setMinValue(10);

valueSelector.getMaxValue();
valueSelector.getMinValue();
valueSelector.getValue(); //get current value

valueSelector.setValueTextColor(getResources().getColor(R.color.colorAccent));
valueSelector.setMinusIconColor(getResources().getColor(R.color.colorAccent));
valueSelector.setPlusIconColor(getResources().getColor(R.color.colorAccent));

valueSelector.setPlusIconResource(R.drawable.ic_plus);
valueSelector.setMinusIconResource(R.drawable.ic_remove_circle);
valueSelector.setValueTextSize(TypedValue.COMPLEX_UNIT_SP, 18);

valueSelector.setBorderColor(Color.BLACK, 0);
valueSelector.setBorderRadius(2);
valueSelector.gapValue(5);
valueSelector.setLayoutOrientation(LinearLayout.VERTICAL);
       

valueselector's People

Contributors

codacy-badger avatar faramarzaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.