Giter Site home page Giter Site logo

watchlibrary's Introduction

WatchLibrary

WatchLibrary Is a tool library for watch development

Quick Setup

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

	dependencies {
		...
	        implementation 'com.github.xzp-github:WatchLibrary:v1.0.4'
	}

Step 3. Add permission

add Read and write SDcard permissions

Step 4. Just call WatchUtils.init(context) in your own Application:

public class MyOwnApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        WatchUtils.init(this);
    }
    ...
}

APIs

  • Log相关 ->Logger

    init 			:初始化
    d
    i
    e
    w
    
  • 圆形CircleImageView -> 参考

  • 圆形RelativeLayout -> RCRelativeLayout

    CircularRelativeLayout已过时
    
属性名称 摘要 是否必须设置 类型
round_corner 总体圆角半径 dp
round_corner_top_left 左上角圆角半径 dp
round_corner_top_right 右上角圆角半径 dp
round_corner_bottom_left 左下角圆角半径 dp
round_corner_bottom_right 右下角圆角半径 dp
round_as_circle 是否剪裁为圆形 boolean
stroke_width 描边半径 dp
stroke_color 描边颜色 color
clip_background 剪裁背景 boolean
  • 月牙按钮 -> LeftRightButton

    属性 值说明
    app:leftBackground 左边按钮背景
    app:leftImgSrc 左边按钮图片模式下的icon , 'app:leftRightType="img"'设置有效
    app:leftText 左边按钮文字模式下String, 'app:leftRightType="text"'设置有效
    app:rightBackground 右边按钮背景
    app:rightImgSrc 右边按钮图片模式下的icon, 'app:leftRightType="img"'设置有效
    app:rightText 右边按钮文字模式下String, 'app:leftRightType="text"'设置有效
    app:leftRightType 定义按钮当前使用何种模式 图片或者文字 "img" or "text"

    layout xml中使用

    <com.android.mltcode.watchlib.view.LeftRightButton
            android:id="@+id/leftrightbutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            app:leftBackground="@drawable/selector_cancel_bg"
            app:leftRightType="text"
            app:leftText="@string/cancel"
            app:rightText="@string/config"
            app:rightBackground="@drawable/selector_config_bg">
     </com.android.mltcode.watchlib.view.LeftRightButton>
     
    

    MainAcitvity中

     mLeftRightButton = findViewById(R.id.leftrightbutton);
     mLeftRightButton.setLeftRightListener(this);
     
     
      @Override
        public void onLeftClick(View view) {
            if(mTextView != null){
                mTextView.setText("onLeftClick");
            }
        }
    
        @Override
        public void onRightClick(View view) {
            if(mTextView != null){
                mTextView.setText("onRightClick");
            }
        }
    

    如图所示

  • 圆环进度条 -> CircleProgressBar

    isAntiAlias			 		:是否抗锯齿
    getHint			     		:
    setHint 		     		:设置提示语
    getUnit 			 		:
    setUnit				 		:设置单位
    getValue			 		:
    setValue			 		:设置当前进度值
    getMaxValue			  	 	:
    setMaxValue			  	 	:设置最大进度值
    getPrecision		  	 	:
    setPrecision		  	 	:设置精度
    getGradientColors	   	 	:
    setGradientColors	   		:
    getAnimTime			   		:
    setAnimTime			   		:动画时间
    reset				   		:重置
    
    属性名 属性值
    app:antiAlias boolean是否抗锯齿
    app:startAngle 圆弧起始角度,3点钟方向为0,顺时针递增,小于0或大于360进行取余 float
    app:sweepAngle 圆弧度数 float
    app:animTime 设置动画时间 integer
    app:maxValue 绘制内容的数值 最大值 float
    app:value 绘制内容的数值 当前值 float
    app:precision 精度,默认为0
    app:valueSize
    app:valueColor
    app:textOffsetPercentInRadius 文字的偏移量。相对于圆半径而言,默认三分之一
    app:percent
    app:hint 绘制内容相应的提示语
    app:hintSize
    app:hintColor
    app:unit 绘制内容的单位
    app:unitSize
    app:unitColor
    app:arcWidth 圆弧宽度
    app:arcColors 圆弧颜色
    app:bgArcColor 背景圆弧颜色,默认白色
    app:bgArcWidth 背景圆弧宽度
    <com.android.mltcode.watchlib.view.CircleProgressBar
            android:id="@+id/duration_cpb"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="40dp"
            app:antiAlias="true"
            app:arcColors="@array/sport_progress_colors"
            app:arcWidth="@dimen/sport_chart_arc_width"
            app:bgArcColor="@color/sport_bgArcColor"
            app:bgArcWidth="@dimen/sport_chart_arc_width" />
    

    如图所示

watchlibrary's People

Contributors

artillerymans avatar xzp-github avatar artillertoman avatar

Stargazers

 avatar  avatar

Watchers

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