Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jumman04/analogue-watch

Analog Clock Library is a customizable Android library that displays time in a traditional analog format. Easily integrate a stylish analog clock into your app with adjustable colors, markers, hand styles, ticking sound effects, and more.
https://github.com/jumman04/analogue-watch

analog-clock android android-development android-library clock-widget custom-view customizable customizable-ui java kotlin library open-source time-display ui-component ui-design

Last synced: 24 days ago
JSON representation

Analog Clock Library is a customizable Android library that displays time in a traditional analog format. Easily integrate a stylish analog clock into your app with adjustable colors, markers, hand styles, ticking sound effects, and more.

Awesome Lists containing this project

README

        


App Icon


API Level 17 and above

JitPack Version


GitHub Forks


GitHub Stars


GitHub License


Analog Clock Library

Analog Clock Library is a customizable Android library for displaying time in a traditional analog
format. It provides developers with a range of customization options to adjust various aspects such
as hour markers, minute markers, hour indicator text, and clock hands (hour, minute, second) to suit
their application's design.

---

## Features

- Display time in a traditional analog format
- Customize background color, marker colors, and hand colors
- Adjust heights and widths of minute markers, hour markers, and hands
- Enable/disable minute markers, hour markers, and hour indicator text
- Ticking sound effects with adjustable volume
- Customize text size, font family, text color, and text style for hour indicator text

---

### Installation

Add JitPack repository to your root build.gradle file:
Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

```groovy
dependencies {
implementation 'com.github.Jumman04:Analogue-Watch:4.2'
}
```

---

## Usage in XML Layouts

```xml

```

## Usage in Programmatic

```java
AnalogClock analogClock = new AnalogClock(this);
```

---

## Customization Attributes

Customize the appearance of the `AnalogClock` view by using the following XML attributes:

### Color Attributes

- `background_color`: Background color of the clock face
- `minute_marker_color`: Color of minute markers
- `hour_marker_color`: Color of hour markers
- `second_hand_color`: Color of the second hand
- `minute_hand_color`: Color of the minute hand
- `hour_hand_color`: Color of the hour hand
- `textColor`: Text color for hour indicator text

### Dimension Attributes

- `minute_marker_height`: Height of minute markers
- `hour_marker_height`: Height of hour markers
- `textSize`: Text size for hour indicator text

### Boolean Attributes

- `minute_marker`: Enable/disable display of minute markers
- `hour_marker`: Enable/disable display of hour markers
- `enable_sound`: Enable/disable ticking sound effects
- `enable_hour_text`: Enable/disable display of hour indicator text

### Text Attributes

- `fontFamily`: Font family for hour indicator text

---

## Example XML usage with attributes:

```xml

```

## Programmatic Customization

You can also customize the AnalogClock view programmatically:

```kt
analogClock.setBackgroundColor(Color.WHITE)
analogClock.setMarkerColor(minuteMarkerColor = Color.GRAY, hourMarkerColor = Color.BLACK)
analogClock.setHandColor(secondHandColor = Color.RED, minuteHandColor = Color.BLUE, hourHandColor = Color.GREEN)
analogClock.setTextColor(Color.BLACK)

analogClock.setMarkerHeight(minuteMarkerHeight = 0.1f, hourMarkerHeight = 0.15f)
analogClock.setHandHeight(secondHandHeight = 0.8f, minuteHandHeight = 0.7f, hourHandHeight = 0.6f)
analogClock.setHandWidth(secondHandWidth = 0.02f, minuteHandWidth = 0.03f, hourHandWidth = 0.04f)
analogClock.setTextSize(14f)

analogClock.enableHourText(true)
analogClock.enableSound(true)
analogClock.enableMarkers(minuteMarker = true, hourMarker = true)
analogClock.enableHands(secondHand = true, minuteHand = true, hourHand = true)

analogClock.setVolume(0.5f)
analogClock.setMediaPlayer(R.raw.clock_tick)

analogClock.setTypeface(Typeface.SANS_SERIF)

```

## Feature Requests

If you have a feature request or a suggestion for improving this library, please feel free
to [open an issue](https://github.com/Jumman04/Analogue-Watch/issues/new) and let us know! We
appreciate your feedback and are always looking to make our library better.

#### How to Request a Feature

1. Click on the [Issues tab](https://github.com/Jumman04/Analogue-Watch/issues).
2. Click the green "New Issue" button.
3. Fill in the requested information and submit the issue.

# Thank you for using and contributing to the improvement of our library!