All Projects → yonat → BatteryView

yonat / BatteryView

Licence: MIT License
Simple battery shaped UIView

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to BatteryView

esctoolbox-python
Python version of Gregory Plett's ESCtoolbox
Stars: ✭ 47 (-4.08%)
Mutual labels:  battery
smbusb
USB SMBus Interface
Stars: ✭ 93 (+89.8%)
Mutual labels:  battery
AndroidBatteryStats
Displays all battery stats of an Android device using broadcast receiver.
Stars: ✭ 20 (-59.18%)
Mutual labels:  battery
KISS Battery Monitor
Open TX Telemetry Script to support KISS 24a telemetry data callouts
Stars: ✭ 19 (-61.22%)
Mutual labels:  battery
UniRate
Unity plugin to easily manage the application frame rate and rendering interval. Preventing battery power consumption and device heat, especially on mobile platforms.
Stars: ✭ 26 (-46.94%)
Mutual labels:  battery
HeartBattery
❤️ display the OS X battery state as hearts in the menubar
Stars: ✭ 17 (-65.31%)
Mutual labels:  battery
ATtiny85-TinyCharger
Single-Cell Li-Ion Battery Charger with Monitoring
Stars: ✭ 20 (-59.18%)
Mutual labels:  battery
tesla-style-solar-power-card
Home assistant power card mimicking the one tesla provides for the powerwall app.
Stars: ✭ 103 (+110.2%)
Mutual labels:  battery
Sensors
A macOS application displaying the thermal, voltage and current sensor values.
Stars: ✭ 70 (+42.86%)
Mutual labels:  battery
zelda-battery
A Legend of Zelda inspired health-bar battery meter for the CLI and GUI
Stars: ✭ 22 (-55.1%)
Mutual labels:  battery
swaystatus
A minimal executable for displaying sway status per second
Stars: ✭ 14 (-71.43%)
Mutual labels:  battery
bat
Battery management utility for Linux laptops.
Stars: ✭ 107 (+118.37%)
Mutual labels:  battery
LawRun
Kernel source code (LawRun Kernel) for xiaomi sdm845 | Pocophone f1 (beryllium), Mi 8 (dipper), Mi Mix 2s (polaris) | You can fork and enjoy.
Stars: ✭ 22 (-55.1%)
Mutual labels:  battery
tesla powerwall
Python API for Tesla Powerwall
Stars: ✭ 43 (-12.24%)
Mutual labels:  battery
macstats
Mac OS X Statistics - Battery, Fans, CPU
Stars: ✭ 55 (+12.24%)
Mutual labels:  battery
lovelace-battery-entity-row
Show battery states or attributes with dynamic icon on entity rows in Home Assistant's Lovelace UI
Stars: ✭ 49 (+0%)
Mutual labels:  battery
youtube-audio
Disable videos on youtube and save battery and bandwidth / data
Stars: ✭ 110 (+124.49%)
Mutual labels:  battery
powersave
Linux power save settings, compatible with systemd
Stars: ✭ 79 (+61.22%)
Mutual labels:  battery
impedance.py
A Python package for working with electrochemical impedance data
Stars: ✭ 102 (+108.16%)
Mutual labels:  battery
batify
Only one udevrule file triggering plug and critical battery level notifications (multi-x sessions support)
Stars: ✭ 47 (-4.08%)
Mutual labels:  battery

BatteryView

Simple battery shaped UIView.

Swift Version Build Status License CocoaPods Compatible
Platform PRs Welcome

Usage

let batteryView = BatteryView(frame: smallRect)
batteryView.level = 42 // anywhere in 0...100
batteryView.lowThreshold = 25 // battery fill becomes red if level is below this threshold
batteryView.gradientThreshold = 50 // battery fill gradually changes from green to red below this threshold

SwiftUI

Use BatteryShape from the swiftui branch.

Changing Appearance

The properties below can be set in Interface Builder, in code, or through a UIAppearance proxy (e.g., BatteryView.appearance().borderColor = .gray).

Colors:

batteryView.borderColor    = .darkGray
batteryView.highLevelColor = .green
batteryView.lowLevelColor  = .red
batteryView.noLevelColor   = .gray
batteryView.noLevelText = "?" // shown over battery when the level is undefined or out of bounds

Battery Shape:

batteryView.direction = .minXEdge     // terminal facing left

batteryView.terminalLengthRatio = 0.1 // relative to battery length
batteryView.terminalWidthRatio = 0.4  // relative to battery width

batteryView.borderWidth = 2.5         // default is batteryLength / 20
batteryView.cornerRadius = 5          // default is batteryLength / 10

Installation

CocoaPods:

pod 'BatteryView'

Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/yonat/BatteryView", from: "1.3.9")
]

Meta

@yonatsharon

https://github.com/yonat/BatteryView

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].