Giter Site home page Giter Site logo

selectframeview's Introduction

Platform SDK

SelectFrameView

模仿手淘自动识别 UI 选择控件

Name Display
SelectSimpleDraweeView

用法

class VisionSelectSimpleDraweeView: SelectSimpleDraweeView<VisionBoxInfo> {
    constructor(context: Context) : this(context, null)
    constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
}
<com.jarvis.demo.ui.VisionSelectSimpleDraweeView
    android:id="@+id/js_view"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent" />
selectView = findViewById(R.id.js_view)
selectView.setImageURI("https://inews.gtimg.com/newsapp_bt/0/13560755311/641")
selectView.registerDataTransform(transform)
selectView.registerFrameChangeListener(frameCallback)
val focusList = arrayListOf(
    VisionBoxInfo(0.43f, 0.3f, 0.3f, 0.5f),
    VisionBoxInfo(0.5f, 0.5f, 0.5f, 0.5f)
)
selectView.setFrameData(focusList)
selectView.showFrameData(focusList[0])

/** 刷新数据 */
val refresh = findViewById<Button>(R.id.refresh)
refresh.setOnClickListener {
    selectView.setFrameData(arrayListOf(
        VisionBoxInfo(0.58f, 0.525f, 0.33f, 0.21f),
        VisionBoxInfo(0.28f, 0.48f, 0.53f, 0.51f)
    ))
}

/** 选择一个焦点 frame */
val focus = findViewById<Button>(R.id.append_focus)
focus.setOnClickListener {
    selectView.showFrameData(focusList[1])
}

/** 选择空焦点 frame */
val unFocus = findViewById<Button>(R.id.append_unfocus)
unFocus.setOnClickListener {
    selectView.showFrameData(VisionBoxInfo(0.7f, 0.75f, 0.4f, 0.4f))
}

引入

方式 1:

repositories {
    // ...
    maven {
        name = "GitHubPackages"
        url = uri("https://maven.pkg.github.com/JarvisGG/SelectFrameView")
        credentials {
            username = "JarvisGG"
            password = "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"
        }
    }
}

dependencies {
    implementation Libs.AndroidX.dynamicanimation // 目前 demo 依赖管理采用 buildSrc
    implementation "com.jarvis.libraries:select-base:1.0.3"
    // 如果需要 fresco 扩展,请添加
    implementation Libs.Fresco.core
    implementation "com.jarvis.libraries:select-fresco:1.0.2"
}

方式 2:

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    implementation 'com.github.JarvisGG:SelectFrameView:1.0.5'
}

selectframeview's People

Stargazers

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