• This repository has been archived on 25/Apr/2023
  • Stars
    star
    383
  • Rank 111,995 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Custom Switches for Android

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.

More Repositories

1

android-filepicker

Selecting directories/files made a lot easier.
Java
644
star
2

Fookart

A multi tenant e-commerce web application
Java
6
star
3

Todo-List-Application

Kotlin
4
star
4

KYO

Udacity Android Developer Nanodegree Capstone Project
Java
3
star
5

KMM-Sample-App

Kotlin Multiplatform sample app of Images gallery for Android and iOS. Includes: Ktor client and features, kotlinxserializer, coroutines, kodein, unit tests
Kotlin
3
star
6

Visionary

Java
2
star
7

Derpina

A literally dumb assistant that manages my room
Java
2
star
8

RecyclerView

Android Application - RecyclerView with custom view using sample data
Java
2
star
9

android-daterangepicker

Material Design Date Range Picker for Android
Java
2
star
10

StockHawk

StockHawk
Java
2
star
11

PopularMovies2

Popular Movies Stage 2.
Java
2
star
12

Android_InterfaceListener_SharedPref_NavDrawer_Frag_RecyclerView

Java
2
star
13

JetDroid

Collect articles and fly towards exit location in short time.
C#
1
star
14

PopularMovies1

Popular Movies Stage 1.
Java
1
star
15

AndroidPlayground

Kotlin
1
star
16

ApkWizard

Kotlin
1
star
17

Braillo

A chat application for blind people.
Java
1
star
18

BuildItBigger

Build It Bigger
Java
1
star
19

Go-Ubiquitous

Java
1
star
20

Gates16

Java
1
star
21

CustomViewDemo

Java
1
star
22

Stargazer

A Custom View to Rate things.
Java
1
star
23

Localhost

Local Navigation using in house Wifi
Java
1
star
24

android-debugger

Java
1
star
25

MyAppPortfolio

Udacity Nanodegree Project 0.
Java
1
star
26

Nature

A test repository for custom views and viewgroups in android containing natural elements.
Java
1
star
27

MakeYourAppMaterial

Make Your App Material
Java
1
star
28

JavaPlayground

Example Java Programs
Java
1
star
29

File-Ware

A cross platform file sharing Desktop Application
Java
1
star
30

DataStructures

Implementing Data Structures in JAVA
Java
1
star
31

SingleActivityApplication

A Dummy Single Activity Android Application
1
star
32

Learn2Code

Archive for Beginner Programmers. Contains basic programmes of selected Languages.
Java
1
star
33

Text-Analyzer

Finding frequency of N letter words from multiple texts.
Java
1
star
34

RxAndroid-Retrofit-Demo

Just an App!
Java
1
star
35

RoomRetroRxDagger

Dagger, RxJava, Room, Retrofit and MVP
Kotlin
1
star
36

Capstone-Project

Udacity Android Developer Nanodegree Project
1
star