/AnalogClockView

AnalogClockView is a custom view library for android development. It takes time from the device and show time by Analog clock

Primary LanguageKotlinApache License 2.0Apache-2.0

AnalogClockView License

Output:

Usage:

  1. Add it in your root build.gradle at the end of repositories:
	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
  1. Add the dependency in app-level build.gradle
dependencies {
          implementation 'com.github.Hemu43362:AnalogClockView:0.0.1'
  }
  1. Layout implementation
  <com.hemantpatel.clock_library.AnalogClockView
      android:id="@+id/clock_view"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:pointsColor="#EAC53E"
      app:dialColor="#CDFFD2"
      app:secondHandColor="#FD602F"
      app:minuteHandColor="#7789EF"
      app:hourHandColor="#29BC65"
      app:secondHandWidth="5"
      app:minuteHandWidth="10"
      app:hourHandWidth="15"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toTopOf="parent" />
  1. Don't forget to call startClock() in OnStart() and stopClock() in OnStop()
   // get reference of AnalogClockview
   private val mClockView: AnalogClockView
        get() = findViewById(R.id.clock_view)
   override fun onStart() {
        super.onStart()
        mClockView.startClock()
    }
   override fun onStop() {
        super.onStop()
        mClockView.stopClock()
    }

Attribute details:

Atrribute Properties Type Default Value̥
pointsColor color of points which indicates the numbers Color Color.WHITE
dialColor color of dial of watch Color Color.GRAY
secondHandColor color of second hand Color Color.RED
minuteHandColor color of minute hand Color Color.YELLOW
hourHandColor color of hour hand Color Color.GREEN
secondHandWidth width of second hand Float 8f
minuteHandWidth width of minute hand Float 12f
hourHandWidth width of hour hand Float 15f

Changelog:

0.0.1

  • Initial release
  • added attributes for customize clock hand, dial and points

License:

Copyright 2021 HemantPatel
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.