GithubHelp home page GithubHelp logo

rosenpin / fading-text-view Goto Github PK

View Code? Open in Web Editor NEW
1.7K 36.0 224.0 962 KB

A TextView that changes its content automatically every few seconds

Java 3.97% Kotlin 96.03%
textview animation android android-library

fading-text-view's Introduction

FadingTextView

DOCS API

A TextView that changes its content automatically every few seconds

example

Usage

Download

FadingTextView is available on JitPack

Step 1. Add the JitPack repository to your root build.gradle

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

Step 2. Add the dependency

dependencies {
    implementation 'com.github.rosenpin:fading-text-view:3.3'
}

Texts

First, you need to create a string-array in your values folder like so:

<string-array name="examples">
     <item>Hello</item>
     <item>Fading TextView</item>
</string-array>

Then in your layout

<com.tomer.fadingtextview.FadingTextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:texts="@array/examples" />

Timeout

You can set the amount of time that each text is visible by using the timeout attribute and by specifying the length of time in milliseconds. Like so:

app:timeout="500"
<com.tomer.fadingtextview.FadingTextView
            android:id="@+id/fadingTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:timeout="500"
            app:texts="@array/examples" />

Updating the view dynamically - Kotlin

To set the text dynamically, you can use

val texts = arrayOf("text1", "text2", "text3")
val fadingTextView = findViewById<FadingTextView>(R.id.fadingTextView)
fadingTextView.setTexts(texts) // You can use an array resource or a string array as the parameter
//fadingTextView.setTexts(R.array.examples)

To set the timeout between text changes you can use:

//For text change once every hour
fadingTextView.setTimeout(60.minutes)

//For text change once every half a minute
fadingTextView.setTimeout(0.5.minutes)

//For text change every 10 seconds
fadingTextView.setTimeout(10.seconds)

//For text change every 500 milliseconds (0.5 seconds)
fadingTextView.setTimeout(500.milliseconds)

Or you can shuffle texts that you set

fadingTextView.shuffle()

Updating the view dynamically - JAVA

To set the text dynamically, you can use

String[] texts = {"text1","text2","text3"};
FadingTextView FTV = (FadingTextView) findViewById(R.id.fadingTextView);
FTV.setTexts(texts); //You can use an array resource or a string array as the parameter

To set the timeout between text changes you can use:

//For text change once every hour
FTV.setTimeout(60, MINUTES);

//For text change once every half a minute
FTV.setTimeout(0.5, MINUTES);

//For text change every 10 seconds
FTV.setTimeout(10, SECONDS);

//For text change every 500 milliseconds (0.5 seconds)
FTV.setTimeout(500, MILLISECONDS);

Shuffle

You can randomize the order of the strings using the shuffle method
Note: you will need to run the shuffle method after each time you update the view
Example:

FTV.setTexts(texts);
FTV.shuffle();

Full Documentation

Click me for the full documentation

License

Copyright (c) Tomer Rosenfeld 2016-2017

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.

fading-text-view's People

Contributors

arryan avatar dakdroid avatar ebayraktar avatar ig-moreno avatar rosenpin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fading-text-view's Issues

Null pointer exception and render problem

java.lang.NullPointerException   at com.tomer.fadingtextview.FadingTextView.startAnimation(FadingTextView.java:269)   at com.tomer.fadingtextview.FadingTextView.resume(FadingTextView.java:59)   at com.tomer.fadingtextview.FadingTextView.onAttachedToWindow(FadingTextView.java:101)

Setting empty text causes crash

I knew that setting empty text array is not allowed. But, what if we want to set it during runtime only, instead of initially setting it with app:texts="@array/my_texts"?

We can show an empty text if the array is empty. Throwing IllegalArgumentException directly is not a good action.

Suggest

Hello,
I saw your source, I feel that the effect of using ViewFlipper to do, may be more convenient

setTimeout(JAVA)

The setTimeout in java doesn't display and i can't also use the app:timeout on xml, kindly advise

Cannot resolve library into project

image

As above, the repository seems to be unreachable in JitPack to use, doing a lookup says i have no read access to the repo

image

Trying to test the library on a freshly made project from Android Studio with Gradle

Clicking Apply Changes in Android Studio causes crash when Activity containing FadingTextView is in foreground

activity_main.xml

 <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:id="@+id/drawerid"
android:background="@color/background"
tools:context=".MainActivity">

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
    <androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">  

    <!-- Main content -->

 <FrameLayout
    android:id="@+id/framelayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/action_bar"
    android:layout_marginTop="60dp"
    android:layout_marginBottom="48dp"
    >

</FrameLayout>
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom">

    <include layout="@layout/bottom_navigation"
        android:id="@+id/bottom_view"
        android:layout_height="wrap_content"
        android:layout_width="match_parent" />

</FrameLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_toStartOf="@id/d_layout"
    android:layout_alignParentStart="true"
    android:layout_alignBottom="@id/d_layout"
    android:layout_marginBottom="5dp"
    >

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/constraintLayout2"
        android:layout_width="0dp"
        android:layout_height="40dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ProgressBar
            android:id="@+id/progress_bar"
            style="@style/Widget.AppCompat.ProgressBar.Horizontal"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="10sp"
            android:indeterminateDrawable="@drawable/bg_progress_bar_green"
            android:max="100"
            android:progress="1"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@id/clicks"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/step1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            android:layout_marginVertical="5dp"
            android:background="@drawable/radius_button_bg"
            android:gravity="center"
            android:text="1"
            android:textColor="@color/whiteTextColor"
            app:layout_constraintBottom_toBottomOf="@id/progress_bar"
            app:layout_constraintStart_toStartOf="@id/progress_bar"

            app:layout_constraintTop_toTopOf="@id/progress_bar" />

        <TextView
            android:id="@+id/step2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_marginVertical="5dp"
            android:background="@drawable/radius_button_bg"

            android:gravity="center"
            android:text="25"

            android:textColor="@color/whiteTextColor"
            app:layout_constraintBottom_toBottomOf="@id/progress_bar"
            app:layout_constraintStart_toEndOf="@id/step1"
            app:layout_constraintEnd_toStartOf="@id/step3"
            app:layout_constraintTop_toTopOf="@id/progress_bar" />

        <TextView
            android:id="@+id/step3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_marginVertical="5dp"
            android:background="@drawable/radius_button_bg"

            android:gravity="center"
            android:text="50"
            app:layout_constraintEnd_toStartOf="@id/step4"
            android:textColor="@color/whiteTextColor"
            app:layout_constraintBottom_toBottomOf="@id/progress_bar"
            app:layout_constraintStart_toEndOf="@id/step2"
            app:layout_constraintTop_toTopOf="@id/progress_bar" />

        <TextView
            android:id="@+id/step4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_marginVertical="5dp"
            android:background="@drawable/radius_button_bg"

            android:gravity="center"
            android:text="100"
            app:layout_constraintEnd_toEndOf="@id/progress_bar"
            android:textColor="@color/whiteTextColor"
            app:layout_constraintBottom_toBottomOf="@id/progress_bar"

            app:layout_constraintTop_toTopOf="@id/progress_bar" />
        <com.tomer.fadingtextview.FadingTextView
            app:timeout="2000"
            android:layout_width="65dp"
            android:layout_height="wrap_content"
            android:id="@+id/clicks"
            android:text="@array/hello"
            android:gravity="center"

            app:layout_constraintBottom_toBottomOf="@id/progress_bar"
            app:layout_constraintStart_toEndOf="@id/progress_bar"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/progress_bar"
            android:textStyle="bold"
            android:textColor="#311B92"
            android:textSize="16sp"/>
    </androidx.constraintlayout.widget.ConstraintLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentTop="true"

    android:id="@+id/d_layout"
    android:elevation="5dp"
    android:orientation="horizontal">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="15dp"
        android:layout_marginStart="10dp"
        android:layout_marginEnd="40dp"
        android:layout_height="wrap_content"
        android:background="@drawable/coin_outline_view_bg"

        android:elevation="15dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:orientation="horizontal"
            android:paddingBottom="3dp"
            android:paddingEnd="17dp"
            android:paddingStart="5dp"
            android:paddingTop="3dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="3dp"
                android:text="💰"
                android:textColor="@color/colorAccent"

                android:textSize="18sp"

                android:textStyle="bold"

                />

            <ProgressBar
                android:id="@+id/process_bar"
                android:layout_width="40dp"
                android:layout_height="24dp"
                android:layout_gravity="center_vertical" />



            <TextView
                android:id="@+id/coin_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:text="0"
                android:textColor="@color/darkTextColor"
                android:textSize="18sp"
                android:textStyle="bold"

                android:visibility="gone"

                />
        </LinearLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="43dp"
        android:layout_height="43dp"

        android:layout_marginBottom="15dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/bg_fab"
        android:elevation="15dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"

        app:layout_constraintTop_toTopOf="parent">


        <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/drawer_icon"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="3dp"


            android:clickable="true"
            android:focusable="true"
            android:src="@drawable/person"

            app:civ_border_color="@color/colorAccent"
            app:civ_border_width="1dp"
            app:civ_circle_background_color="@color/whiteTextColor" />

    </androidx.constraintlayout.widget.ConstraintLayout>


</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/coinButton"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:layout_marginEnd="20dp"
    android:layout_marginBottom="65dp"
    android:clickable="true"
    android:theme="@style/MyMaterialTheme"
    app:fabCustomSize="50dp"
    android:layout_alignParentEnd="true"
    android:layout_alignParentBottom="true"
    android:scaleType="center"
    android:visibility="gone"

    app:tint="@null"
    app:srcCompat="@drawable/coin_white"
    android:backgroundTint="@color/gradientLightBlue"
    android:focusable="true"
    android:contentDescription="Survey Offer" />

</RelativeLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        android:id="@+id/view"
        android:orientation="vertical" />
</RelativeLayout>
<com.rom4ek.arcnavigationview.ArcNavigationView

    android:id="@+id/nav_view_right"

    android:layoutDirection="ltr"

    android:layout_width="wrap_content"

    android:layout_height="match_parent"

    android:layout_gravity="end"

    android:background="@android:color/white"

    android:fitsSystemWindows="true"

    app:arc_cropDirection="cropOutside"

    app:arc_width="52dp"

    app:itemBackground="@android:color/white"



    app:menu="@menu/main_activity_actions"/>

</androidx.drawerlayout.widget.DrawerLayout>

loagcat

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.curiousminds.ytcreatorszone/com.curiousminds.ytcreatorszone.MainActivity}: android.view.InflateException: Binary XML file line #2 in com.curiousminds.ytcreatorszone:layout/activity_main: Attempt to read from null array
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3704)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3871)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5809)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5712)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58)
at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5765)
at android.app.ActivityThread.access$3400(ActivityThread.java:292)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2318)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:257)
at android.app.ActivityThread.main(ActivityThread.java:8239)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
Caused by: android.view.InflateException: Binary XML file line #2 in com.curiousminds.ytcreatorszone:layout/activity_main: Attempt to read from null array
Caused by: java.lang.NullPointerException: Attempt to read from null array
at com.tomer.fadingtextview.FadingTextView.startAnimation(FadingTextView.java:289)
at com.tomer.fadingtextview.FadingTextView.resume(FadingTextView.java:62)
at com.tomer.fadingtextview.FadingTextView.onAttachedToWindow(FadingTextView.java:104)
at android.view.View.dispatchAttachedToWindow(View.java:20731)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3516)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3516)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3516)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3516)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3516)
at android.view.ViewGroup.addViewInner(ViewGroup.java:5359)
at android.view.ViewGroup.addView(ViewGroup.java:5137)
at android.view.ViewGroup.addView(ViewGroup.java:5109)
at android.view.LayoutInflater.inflate(LayoutInflater.java:689)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.curiousminds.ytcreatorszone.MainActivity.onCreate(MainActivity.java:131)
at android.app.Activity.performCreate(Activity.java:8146)
at android.app.Activity.performCreate(Activity.java:8130)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3673)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3871)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5809)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5712)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:140)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:100)
2021-11-19 16:20:11.849 30665-30665/com.curiousminds.ytcreatorszone E/AndroidRuntime: at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58)
at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5765)
at android.app.ActivityThread.access$3400(ActivityThread.java:292)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2318)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:257)
at android.app.ActivityThread.main(ActivityThread.java:8239)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)

too many animations issue

You have startAnimation() in onAttachedToWindow and in handleAttrs() which make animations too fast. In my case it was: first text OK, second much too fast, third OK, fourth many too fast.

Fix outdated documentation

  • update examples in README to use Kotlin
  • update setTimeout to use Kotlin's duration
  • add jetpack compose usage example using AndroidView

Animation TimeOut Bug

Hello,
First of all thank you for this easy to use library :)

I found a little bug on your library. When i use fadingTextView.setTimeout(1500) after sometime it just do not wait 1500 ( or whatever i set ) just flick around the array.

Fortunately, when i set timeout in xml as app:timeout="1500" it did not skip too fast.

I hope you will fix it, when you have time :)
Enjoy!

Feature request

I miss a function to fade into text of a specific position in the array

Rename attributes to avoid conflicts

If Android Leanback library is added along side with your project, app build will fail with this error:

Resource compilation failed (Failed to compile values resource file Q:\Projects\Libs\android\fading-text-view\app\build\intermediates\incremental\debug\mergeDebugResources\merged.dir\values\values.xml. Cause: java.nio.file.InvalidPathException: Illegal char <:> at index 59: com.tomerrosenfeld.fadingtextview.app-mergeDebugResources-2:/values/values.xml). Check logs for more details.

This is due to a conflict with a declared style:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="FadingTextView">
        <attr name="texts" format="reference" />
        <attr name="timeout" format="integer" />
        <attr name="shuffle" format="boolean" />
    </declare-styleable>
</resources>

The problem is with the shuffle attribute, it is already declared in the Leanback library.

stopAnimation的问题

在stopAnimation的时候调用的removeCallbacksAndMessages,这个会把所有在排队的任务都给remove掉,可能导致一些问题使用者还不知道是怎么回事。

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.