Coder Social home page Coder Social logo

compassservant's Introduction

CompassServant|中文文档

this is a practice view like compass or dashboard, you can set color gradient wish what you want.

ScreenShot Video

Download

maven

<dependency>
  <groupId>com.dyzs.compassservant</groupId>
  <artifactId>compassservant</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

gradle

compile 'com.dyzs.compassservant:compassservant:1.0.0'

Usage

xml sample

<com.dyzs.compassservant.CompassServant
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:background="@color/black"
    android:padding="5dp"
    app:cs_color_commander="4"
    app:cs_color1="@color/alice_blue"
    app:cs_color2="@color/cinnabar_red"
    app:cs_color3="@color/green"
    app:cs_color4="@color/white"
    app:cs_galaxy_degree="280"
    app:cs_outer_circle="7dp"
    app:cs_tick_mark_length="30dp"
    app:cs_decibel="119"
    app:cs_text_size="30dp"
    />

and reset tick value and start animation

compass_servant.setPointerDecibel(iRandom);

also add listener and start tension when you reset pointer

compass_servant.setServantListener(new CompassServant.ServantListener() {
        @Override
        public void startTension() {
            mLooper.sendEmptyMessage(MESSAGE);
        }
    });

Attributes

using sys attrs {android.R.attr.background, android.R.attr.padding}

attr
android:background The background color {android.R.attr.background}.
android:padding The spacing between border and outer circle{android.R.attr.padding}.
app:cs_color_commander {2~4},the number of your gradient colors in xml.
app:cs_color1 The 1st color.
app:cs_color2 The 2nd color.
app:cs_color3 The 3rd color.
app:cs_color4 The 4th color.
app:cs_galaxy_degree The degree of your set in xml.
app:cs_outer_circle Outer circle width.
app:cs_tick_mark_length The compass tick length.
app:cs_decibel Number of tick mark.
app:cs_text_size The current tick mark text size.

License

Copyright (C) 2018 Misaka Mikoto(dyzs)

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.

compassservant's People

Contributors

dyzs avatar akumalucifer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.