All Projects → shrikanth7698 → Night-Mode-Button

shrikanth7698 / Night-Mode-Button

Licence: MIT license
Easy to use night mode button with cool animation

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Night-Mode-Button

liquid button
Liquify your buttons, web demo at website
Stars: ✭ 18 (-75.68%)
Mutual labels:  button, button-widget, button-animation
TextButton
⏹️ An easy to use `TextButton` when you need a TextView-like button, with handy touch feedback effects.
Stars: ✭ 19 (-74.32%)
Mutual labels:  button, button-widget
TDButton
TDButton 带有动画效果、支持各种对齐方式的按钮
Stars: ✭ 12 (-83.78%)
Mutual labels:  button, button-animation
FancyButtonProj
Juste a funcy button with progress bar
Stars: ✭ 27 (-63.51%)
Mutual labels:  button, button-animation
vue-burger-button
🍔 vue-burger-button is a functional component, which is faster than a regular component, and is pretty small (JS min+gzip is lower than 700b and CSS min+gzip is lower than 400b).
Stars: ✭ 41 (-44.59%)
Mutual labels:  button
obvi
A Polymer 3+ webcomponent / button for doing speech recognition
Stars: ✭ 54 (-27.03%)
Mutual labels:  button
Copy-button
copy textview into anywhere
Stars: ✭ 14 (-81.08%)
Mutual labels:  button
wluma
Automatic brightness adjustment based on screen contents and ALS
Stars: ✭ 290 (+291.89%)
Mutual labels:  night-mode
sleek button
A simple but yet customizable button.
Stars: ✭ 63 (-14.86%)
Mutual labels:  button
bootstrap-directional-buttons
Directional / Arrow buttons for Bootstrap
Stars: ✭ 18 (-75.68%)
Mutual labels:  button
DiscordNight
An actual Dark/Nightmode Theme for Discord/BetterDiscord
Stars: ✭ 86 (+16.22%)
Mutual labels:  night-mode
tkmacosx
Tkmacosx is a Python library extension to the Tkinter module. Change background and foreground colors of a Button, Use ColorVar to change colors of multiple widgets just like StringVar, and much more.
Stars: ✭ 48 (-35.14%)
Mutual labels:  button-widget
btnx-config
btnx-config is a configuration tool for btnx (Button Extension). It allows the user to send keyboard combinations or execute commands with mouse buttons. btnx-config provides mouse and button detection, and an easy way to configure btnx's behavior. See https://github.com/cdobrich/btnx/ for btnx.
Stars: ✭ 47 (-36.49%)
Mutual labels:  button
CenteredDrawableButton
Android custom button with centered drawable
Stars: ✭ 26 (-64.86%)
Mutual labels:  button
DarkLight
Webpage in Night Mode
Stars: ✭ 24 (-67.57%)
Mutual labels:  night-mode
react-native-touchable
React-Native button helper library
Stars: ✭ 46 (-37.84%)
Mutual labels:  button
Turn-Off-the-Lights-Firefox-extension-WebExtensions
Firefox extension (WebExtensions)
Stars: ✭ 19 (-74.32%)
Mutual labels:  night-mode
aria-switch-control
ARIA Switch control component
Stars: ✭ 38 (-48.65%)
Mutual labels:  button
vue-loading-button
👇 Vue button with slideout loading indicator
Stars: ✭ 39 (-47.3%)
Mutual labels:  button
smart-webcomponents-community
Material & Bootstrap Web Components built with Smart
Stars: ✭ 30 (-59.46%)
Mutual labels:  button

alt text

Night Mode Button

Night Mode Button Library for Android

Easy to use night mode button with cool day night animation.

Version

Installation

  • Gradle

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

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

    Add the dependency in your app build.gradle

    dependencies {
             implementation 'com.github.shrikanth7698:Night-Mode-Button:V1.0'
     }
  • Maven

    Add the JitPack repository to your build file

     <repositories>
     	<repository>
     	    <id>jitpack.io</id>
     	    <url>https://jitpack.io</url>
     	</repository>
     </repositories>

    Add the dependency

     <dependency>
         <groupId>com.github.shrikanth7698</groupId>
         <artifactId>Night-Mode-Button</artifactId>
         <version>V1.0</version>
       </dependency>

Usage

Drop the Night Mode Button in your XML layout as is shown below:

    	<com.shrikanthravi.library.NightModeButton
		      android:layout_width="wrap_content"
		      android:layout_height="wrap_content"
		      android:layout_centerHorizontal="true"
		      android:id="@+id/nightModeButton"
		      android:layout_centerVertical="true"/>

And then in your Activity or fragment

        
        //Inside onCreate()
         
         NightModeButton nightModeButton;
         RelativeLayout relativeLayout;
    
        relativeLayout = findViewById(R.id.rootLayout);
        nightModeButton = findViewById(R.id.nightModeButton);

        final int colorFrom = getResources().getColor(R.color.white);
        final int colorTo = getResources().getColor(R.color.dark);



        nightModeButton.setOnSwitchListener(new NightModeButton.OnSwitchListener() {
            @Override
            public void onSwitchListener(boolean isNight) {
                if(isNight){
                    //Function to change color
                    animateBackground(colorFrom,colorTo);
                    animateStatusActionBar(getResources().getColor(R.color.colorPrimary),colorTo);
                    Toast.makeText(getApplicationContext(),"Night Mode On",Toast.LENGTH_SHORT).show();
                }else {
                    animateBackground(colorTo,colorFrom);
                    animateStatusActionBar(colorTo,getResources().getColor(R.color.colorPrimary));
                    Toast.makeText(getApplicationContext(),"Night Mode Off",Toast.LENGTH_SHORT).show();
                }
            }
        });
        

        

TODO

  1. Color Customization
  2. Animation Speed
  3. Add Confetti effect

License

MIT License

Copyright (c) 2018 Shrikanth Ravi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].