GoogleClock


Source link: https://github.com/lypeer/GoogleClock

#GoogleClock

An imitation of the clock in Google I/O 2016 . Almost all of the animations and images in it are made by the SVG , so this library may be a wonderful material to learn the SVG's usage in Android . Chinese README is here .

##show

My God ! Why it doesn't appear ... if you can't find the gif , visit here

##Installation You can install GoogleClock by adding the following dependency to your build.gradle:

allprojects {

repositories {

 ...
 maven {
 url "https://jitpack.io" 
}

}
 
}
dependencies {

 compile 'com.github.lypeer:GoogleClock:1.0.0' 
}

##Usage

###Simple Usage :

Just to add the GoogleClock to your activity's xml :

<com.lypeer.googleioclock.GoogleClock

android:layout_width="wrap_content"

android:layout_height="wrap_content"/>

And then the clock will appear .

###Complex Usage

Of course , you can do some configuration in the xml :

<com.lypeer.googleioclock.GoogleClock

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:lyClockWidth="32dp"

app:lyHourWidth="32dp"

app:lyMinWidth="32dp"

app:lySecWidth="32dp"

app:lyDividerHorizontal="32dp"

app:lyDividerVertical="32dp"

app:lyTheme="@style/LyTheme3"

/>

You can configure the following xml attributes for the clock :

attribute value type defalut value description
lyClockWidth dimen 0dp The size of numbers in the clock . But it's priority is lower than the below three attributes .
lyHourWidth dimen 48dp The size of the hour part in the clock .
lyMinWidth dimen 48dp The size of the minutes part in the clock .
lySecWidth dimen 32dp The size of the second part in the clock .
lyDividerHorizontal dimen 4dp The divider's width between the two number in hour , minute and snecond .
lyDividerVertical dimen 16dp The devider's width of the two lines (Hours and mintues are in the same line while seconds the other).
lyTheme reference LyTheme The custom theme .

Your can define a custom theme to change more in the clock , such as following :

<style name="LyTheme2" parent="LyTheme">

<item name="lyColor0">@color/colorRed</item>

<item name="lyColor1">@color/colorYellow</item>

<item name="lyColor2">@color/colorGreen</item>

<item name="lyColor3">@color/colorBlue</item>

<item name="lyColorColon">@color/colorDarkBlue</item>

<item name="lyThickness">@integer/lyThickness_4</item>

<item name="lyColonThickness">@integer/lyThickness_1</item> </style>

You should let The custom theme's parent be LyTheme so that you can only override the attributes you want to change . If not , your theme must contains all of the attributes in LyTheme , or some view may can't work . LyTheme contains following attributes :

attributes value type default value description
lyColor0 color @color/colorRed The first color in the numbers .
lyColor1 color @color/colorYellow The second color in the numbers .
lyColor2 color @color/colorGreen The third color in the numbers .
lyColor3 color @color/colorBlue The forth color in the numbers .
lyColorColon color @color/colorDarkBlue The color of the colon .
lyThickness integer 4 Number's thickness .
lyColonThickness integer 1 Colon's thickness .

Ok , that's all about usage . There is a demo in the library .

##Dependencies

  • org.greenrobot:eventbus:3.0.0

##License

 Copyright 2014-2016 lypeer.  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. 

Resources

Pull or Swipe to Refresh Webview
Simple clock view for displaying uh...time?
Custom toasts with color and icon for Android.
A simple Android project using asynchronous programming with Kotlin Coroutines.
A simple Recycler view adapter with pagination

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes