Toggle

Android Library for Custom Switches.

Лицензия

Лицензия

Группа

Группа

com.github.angads25
Идентификатор

Идентификатор

toggle
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Toggle
Android Library for Custom Switches.
Ссылка на сайт

Ссылка на сайт

https://github.com/angads25/android-toggle
Система контроля версий

Система контроля версий

https://github.com/angads25/android-toggle

Скачать toggle

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.angads25/toggle/ -->
<dependency>
    <groupId>com.github.angads25</groupId>
    <artifactId>toggle</artifactId>
    <version>1.1.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.angads25/toggle/
implementation 'com.github.angads25:toggle:1.1.0'
// https://jarcasting.com/artifacts/com.github.angads25/toggle/
implementation ("com.github.angads25:toggle:1.1.0")
'com.github.angads25:toggle:aar:1.1.0'
<dependency org="com.github.angads25" name="toggle" rev="1.1.0">
  <artifact name="toggle" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.angads25', module='toggle', version='1.1.0')
)
libraryDependencies += "com.github.angads25" % "toggle" % "1.1.0"
[com.github.angads25/toggle "1.1.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Toggle

Android Library for Custom Switches.

Developed by

Angad Singh (@angads25)

Benchmark:

API Build Status

Mentions:

Download Maven Central

Read all about internal classes and functions in the wiki.

Installation

  • Library is also Available in MavenCentral, So just put this in your app dependencies to use it:
    implementation 'com.github.angads25:toggle:1.1.0'

Usage

  1. Start by adding a Switch (eg. LabeledSwitch) in your xml layout as:

        <com.github.angads25.toggle.widget.LabeledSwitch
            android:id="@+id/switch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:textSize="14sp"
            app:on="false"
            app:colorBorder="@color/colorAccent"/>
  2. To the reference of Switch in your Activity/Fragment class set a Toggle Event Handler to it as below:

        LabeledSwitch labeledSwitch = findViewById(R.id.switch);
        labeledSwitch.setOnToggledListener(new OnToggledListener() {
            @Override
            public void onSwitched(LabeledSwitch labeledSwitch, boolean isOn) {
                // Implement your switching logic here
            }
        });

    That's It. All your switching callbacks would be handled in onSwitched method, parameter isOn will provide the current state of the switch.

Switches Available

Labeled Switch

Day Night Switch

License

Copyright (C) 2018 Angad Singh

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.

Версии библиотеки

Версия
1.1.0
1.0.0