Promising, hypertextview (v3.2.1)

Time:2020-2-17

Hi, developer, to see the newSuperTextViewNow!

Promising, hypertextview (v3.2.1)

💡 all of the above demonstrations were conducted bySuperTextViewStrong drive support.

SuperTextViewThe difference is that it’s just a simple control element, but not just a control. It is flexible and changeable, with powerful embedded logic, providing you with rich and colorful but extremely simple development support.

SuperTextViewSave you from complex rendering logic, one line at a timeAPIInterface call, the dazzling rendering effect is instantly presented.

You just need to enjoy the amazing visual effect you have written, and rest assuredSuperTextView

Brand newv3.2.1In the version,SuperTextViewOnce again, I redefined myself. Developers, let’s take a look at the surprises carefully prepared for you! To be careful

This is… GIF?

This time,SuperTextViewBring powerfulGifDrive support.

If in the past, you’ve shown aGifI have been troubled for many days or trapped in some three partiesGifLost in the performance abyss of the library. So now,SuperTextViewThis situation will be completely changed.

GifGraph andSuperTextViewBorn naturally, so you can make aGifThe picture is shown. It’s as simple as you used to show a normal picture.

Benefit fromc/c++High performance, as well as accurate operation of memory.SuperTextViewthrough the use ofc/c++Specially customized powerfulGifDrive the engine.

SuperTextViewOfGifEngine, able to accurately operate image pixel memory, inGifWhen the frame of the image is refreshed, only the local pixel memory is updated, which makesGifThe efficiency of image rendering has made a qualitative leap.

Through asynchronous off screen rendering and multi buffer technology, theSuperTextViewEven in smooth displayGifThe image can still maintain the smoothness of the application interface and the sensitive response speed.

A kind of In the demo above, use theSuperTextViewShowing aNear 17MSize, including265Frame imageGifFigure, the user interface is still very smooth.

Show GIF is super simple!

staySuperTextViewShow oneGifPicture, super simple!

You can directlyXMLConfigure in the layout document or add in the code.

stayXMLMiddle configurationGif

<com.coorchice.library.SuperTextView
    android:id="@+id/stv_1"
    android:layout_width="match_parent"
    android:layout_height="150dp"

    //Configure gif
    app:stv_state_drawable="@drawable/gif_1" />

You can configure a normal image forSuperTextViewConfiguration displayGifGraph.

Configure GIF in code

stv_1 = (SuperTextView) findViewById(R.id.stv_1);
stv_1.setDrawable(R.drawable.gif_1);

It’s so simple and natural,SuperTextViewYou can configure a display without any perceptionGifGraph.

staySuperTextViewIn the kernel logic of,SuperTextViewBe able to intelligentlyGifThe graph is classified, and then the corresponding processing and optimization are made.

Display networkGif, just as simple

If yourGifThe picture is not in the local area, but in the cloud. What should I do?

You don’t have to worry! All at easeSuperTextView

stv_1 = (SuperTextView) findViewById(R.id.stv_1);
stv_1.setUrlImage("http://example.com/images/example.gif");

Just one line of code,SuperTextViewWill assist you in the backgroundGifThe image is loaded and then processed for rendering to the screen.

Actually,SuperTextViewOfDrawable1andDrawable2Image display bit, which can be used for displayGifGraph. All in all, everything is familiar to you.

You can control more

SuperTextViewIt’s not just about showingGifThe picture is so simple that you can control more details.

Play / pause

You can control it at any timeGifPicture, play, or pause.

if (stv.getDrawable() instanceof GifDrawable) {
  //Get the gifdrawable object first
  GifDrawable gifDrawable = (GifDrawable) stv.getDrawable();

  // play
  gifDrawable.play();

  // pause
  gifDrawable.stop();
}

Jump / get specified frame

staySuperTextViewAt any time, you can reach the image of the specified frame and extract the image of the specified frame.

if (stv.getDrawable() instanceof GifDrawable) {
  //Get the gifdrawable object first
  GifDrawable gifDrawable = (GifDrawable) stv.getDrawable();

  //Jump to the specified frame
  gifDrawable.gotoFrame(pre);

  //Get the specified frame
  Bitmap frame = gifDrawable.getFrame(i);
}

A kind of BecauseSuperTextViewCan support local incremental rendering, so when yourGifWhen the graph supports this rendering mode, it means that you may need to callgifDrawable.setStrict(true)openStrict modeTo ensure that the frame jump or the extracted image is correct. This may take some time, so you should try toStrict modeThe next operation is placed in the asynchronous thread.

Fast and slow, whatever you want

SuperTextViewAllow you to modify at willGifThe playback rate of the graph.

if (stv.getDrawable() instanceof GifDrawable) {
  //Get the gifdrawable object first
  GifDrawable gifDrawable = (GifDrawable) stv.getDrawable();

  //Set frame playback interval, 20ms
  gifDrawable.setFrameDuration(20);
}

Promising, hypertextview (v3.2.1)

You can know

adoptSuperTextViewYou can check oneGifThe information of the image is very clear.

  • ObtainGifsize

    //Get width
    int width = gifDrawable.getWidth();
    
    //Get height
    int height = gifDrawable.getHeight();
  • ObtainGifFrame information

    //Get frames
    int frameCount = gifDrawable.getFrameCount();
    
    //Get current frame interval
    int frameDuration = gifDrawable.getFrameDuration();
    
    //Get the current rendered frame
    int framePotision = gifDrawable.getCurrentFrame();
    
    //Whether playing
    boolean isPlaying = gifDrawable.isPlaying();

Better gif

SuperTextViewBy virtue ofGifSeamless integration of rendering, beforeDrawable1andDrawable2All configuration items ofGifIt also works.

Gif as a normal drawable

app:stv_state_drawable_rotate="90"

Let’s take a look at the originalDrawablePlace oneGifWhat’s going to happen.

<com.coorchice.library.SuperTextView
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:paddingLeft="62dp"
    android:paddingRight="10dp"
    Android: text = "little rocket launched! Cheerleading, cheerleading“
    android:textColor="#ffffff"
    android:textSize="22dp"
    app:stv_corner="6dp"
    app:stv_isShowState="true"
    app:stv_solid="#0D1831"

    //Set gif
    app:stv_state_drawable="@drawable/gif_1"

    //Set gif 高
    app:stv_state_drawable_height="40dp"

    //Set gif 宽
    app:stv_state_drawable_width="40dp"

    //Set gif 居左展示
    app:stv_state_drawable_mode="left"

    //Set gif 左间距
    app:stv_state_drawable_padding_left="10dp"/>

The effect is…

Now, willGifTry turning it 90 degrees.

<com.coorchice.library.SuperTextView
    ...
    //Set GIF to rotate 90 degrees
    app:stv_state_drawable_rotate="90"
    ...
/>

Fillet gif

SuperTextViewIt’s unbelievableGifThe rounded figure provides more possibilities for developers.

Promising, hypertextview (v3.2.1)

However, it is surprisingly simple to achieve this effect.

<com.coorchice.library.SuperTextView
    android:layout_width="185dp"
    android:layout_height="138.75dp"
    android:layout_gravity="center_horizontal"
    app:stv_corner="20dp"

    //Set GIF as control background
    app:stv_drawableAsBackground="true"

    app:stv_scaleType="fitCenter"

    //Configure gif
    app:stv_state_drawable="@drawable/gif_1" />

Border gif

You can even easily give oneGifPicture with border.

<com.coorchice.library.SuperTextView
    android:layout_width="350dp"
    android:layout_height="148.4dp"
    android:layout_gravity="center_horizontal"
    android:gravity="center"

    //Plus the text will show more style
    android:text="SuperTextView"

    android:textSize="36dp"
    android:textStyle="bold"
    android:visibility="invisible"
    app:stv_corner="6dp"
    app:stv_drawableAsBackground="true"
    app:stv_isShowState="true"
    app:stv_scaleType="center"

    //Set border color
    app:stv_stroke_color="@color/opacity_8_gray_4c

    //Set border width
    app:stv_stroke_width="5dp"

    app:stv_text_fill_color="#ccffffff"
    app:stv_text_stroke="true"
    app:stv_text_stroke_color="#cc000000"
    app:stv_text_stroke_width="2dp"

    //Configure gif
    app:stv_state_drawable="@drawable/gif_1"/>

The effect is immediate

Easy dynamic Avatar

In the past, some cool dynamic effects often stopped at the complexity and cost of implementation. andSuperTextViewWith more possibilities for you, your inspiration can be unrestrained.

For example, the implementation of dynamic avatars may be the simplest so far.

<com.coorchice.library.SuperTextView
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_marginLeft="30dp"
    app:stv_corner="40dp"

    //Set as background
    app:stv_drawableAsBackground="true"

    //Configure GIF Avatar
    app:stv_state_drawable="@drawable/gif_avatar"

    //Add border
    app:stv_stroke_color="#ffffff"
    app:stv_stroke_width="3dp"
    />

In the code, you can directly configure a network dynamic picture.

stv.setUrlImage("http://gif_avatar.gif");

Promising, hypertextview (v3.2.1)

More surprises

Both drawable supports clicking!

In the new version ofSuperTextViewMedium,Drawable1andDrawable2Has been given a new ability to support accurate response to click action.

SuperTextViewBy monitoring the location of the click action, it can accurately locate the area where it occurs(Drawable1Drawable2perhapsOther regions)And then trigger the corresponding callback monitor.

You can do it forSuperTextViewSet upDrawableClick the action listener on to make the necessary response when the action occurs.

stv.setOnDrawableClickedListener(new SuperTextView.OnDrawableClickedListener() {
    @Override
    public void onDrawable1Clicked(SuperTextView stv) {
        // Drawable1 clicked,do something...
    }
    @Override
    public void onDrawable2Clicked(SuperTextView stv) {
        // Drawable2 clicked,do something...
    }
});

stv.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        //Non drawable area is clicked, do something
    }
});

Background zoom mode support

Now, when youDrawable1As a background image, you can configure different zoom modes for it to achieve the desired effect.

stv.setScaleType(ScaleType.CENTER);

SuperTextViewUp to three zoom modes are available for developers:

  • ScaleType.FIT_XY

    Stretch / compress the picture to tile.

  • ScaleType.FIT_CENTER

    Center the picture adaptively.

  • ScaleType.CENTER

    Center the picture clipping. Default value.

Promising, hypertextview (v3.2.1)

Other updates

  • stayXMLIn the layout document,Drawable1andDrawable2Direct settings are now supportedcolourperhapsShapeDrawable

    //Circle ABCD shape files written in XML
    app:stv_state_drawable="@drawable/circle_f9ad36"
    
    //Use solid color as drawable
    app:stv_state_drawable="#000000"
  • A kind of Minimum supported versionAPIUpgrade to19
  • Rendering performance is at least better than in the past30%
  • Upgrade the default image loading engine to support intelligent caching. Maybe now, you don’t have to introduce a third-party image loading library.

With 5g bringing faster network speed and more powerful device performance, the user interface will increasingly need more dynamic display (a large number of static user interfaces in the past are too dead) to stimulate the user’s senses and stimulate the user’s interest. andSuperTextViewCan help developers easily complete the upcoming transition.

How to start hypertextview v3.2.1?

In projectbuild.gradleChina:

dependencies {
    ...

    implementation 'com.github.chenBingX:SuperTextView:v3.2.1'

    ...
}

Portal area

  • [portal]: Official project address of hypertextview
  • [portal]: hypertextview development reference document – you can learn how to use hypertextview to improve the construction efficiency of your application
  • [portal]: hypertextview API document – you can view all available APIs and properties of hypertextview

  • If you likeSuperTextViewThat’s it.GithubPoint astarA kind of Support!
  • CoorChiceWe will share the dry goods on the blog platform irregularly. Go to coorchice’s [personal homepage] and pay attention to a wave.