Hi, developer, come and see the new SuperTextView!
(viii) The above demonstrations are powerfully driven by SuperTextView.
SuperTextView is unique in that it is a simple control element, but not just a control. It is born with flexible and powerful embedded logic, providing you with colorful but extremely simple development support.
SuperTextView saves you from complex rendering logic, a simple line of API interface calls, dazzling rendering effect instantly.
You just have to enjoy the amazing visual effects you've written, and rest assured that the rest is in SuperTextView.
In the new version of v3.2.1, SuperTextView redefines itself once again. Developers, come and see the surprises carefully prepared for you! To be careful
Is this Gif?
This time, SuperTextView brings powerful Gif driver support to developers.
If, in the past, you've been struggling for days with how to display a Gif diagram on Android, or you've been stuck in the performance abyss of some three-way Gif libraries. Now SuperTextView will completely change that.
Gif diagrams and SuperTextView are naturally created, so you can display a Gif diagram in the most familiar and natural way. It's as simple as you used to show a normal picture.
Thanks to the super high performance of c/c++ and the precise operation of memory. SuperTextView uses c/c++ to customize a powerful Gif driver engine for mobile platforms.
SuperTextView's Gif engine can operate the image pixel memory accurately. When the frame of Gif image is refreshed, only the local pixel memory is updated, which makes the Gif image rendering efficiency get a qualitative leap.
Through asynchronous off-screen rendering and multi-buffer technology, SuperTextView can maintain the smooth application interface and sensitive response speed even when displaying super Gif images smoothly.
(iv) In the Demo above, SuperTextView shows a Gif graph of nearly 17M in size, containing 265 frames of images, and the user interface is still very smooth.
Show Gif super simple!
Show a Gif chart in SuperTextView. It's very simple!
You can configure it directly in the XML layout document or add it in the code.
Configuring Gif in XML
<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 display Gif diagrams for the SuperTextView configuration as you would for a normal image.
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 that SuperTextView allows you to configure and display a Gif diagram without any perception.
In the kernel logic of SuperTextView, SuperTextView can intelligently classify common graphs and Gif graphs, and then make corresponding processing and optimization.
Showing Gif on the Web is as simple as it is
What if your Gif map is not local, but in the cloud?
You don't need to worry! You can trust SuperTextView.
stv_1 = (SuperTextView) findViewById(R.id.stv_1); stv_1.setUrlImage("http://example.com/images/example.gif");
With just one line of code, SuperTextView will help you load the Gif diagram in the background, and then process the rendering to the screen.
(viii) In fact, both the Drawable1 and Drawable2 image display bits of SuperTextView can be used to display Gif graphs. In short, everything is familiar to you.
You can control more.
SuperTextView provides developers with more details than just showing Gif diagrams.
Play/pause
You can control Gif charts, play them, or pause them at any time.
if (stv.getDrawable() instanceof GifDrawable) { // Get the GifDrawable object first GifDrawable gifDrawable = (GifDrawable) stv.getDrawable(); // play gifDrawable.play(); // suspend gifDrawable.stop(); }
Jump/Get the specified frame
In SuperTextView, you can always arrive at the frame image you specified, and can 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); }
(16) Because SuperTextView supports local incremental rendering, when your Gif diagram supports this rendering mode, it means that you may need to turn on strict mode by calling gifDrawable.setStrict(true) to ensure that the frame skip or the extracted image is correct. This may take some time, so you should try to put strict mode operations in asynchronous threads.
Quick or slow, as you like.
SuperTextView allows you to change the playback rate of Gif graphs at will.
if (stv.getDrawable() instanceof GifDrawable) { // Get the GifDrawable object first GifDrawable gifDrawable = (GifDrawable) stv.getDrawable(); // Set frame playback interval, 20ms gifDrawable.setFrameDuration(20); }
You can know it like the palm of your hand.
With SuperTextView, you can get a good grasp of the information of a Gif image.
-
Get Gif dimensions
// Get width int width = gifDrawable.getWidth(); // Get height int height = gifDrawable.getHeight();
-
Getting Gif Frame Information
// Get frames int frameCount = gifDrawable.getFrameCount(); // Get the current frame interval int frameDuration = gifDrawable.getFrameDuration(); // Get the current rendering to that frame int framePotision = gifDrawable.getCurrentFrame(); // Is it playing? boolean isPlaying = gifDrawable.isPlaying();
More brilliant Gif
SuperTextView, with its seamless integration of Gif rendering, previously all the configuration items of Drawable1 and Drawable2 were equally effective when displaying Gif diagrams.
Gif as ordinary Drawable
app:stv_state_drawable_rotate="90"
Let's see what happens when you put a Gif map in the original Drawable location.
<com.coorchice.library.SuperTextView android:layout_width="match_parent" android:layout_height="50dp" android:paddingLeft="62dp" android:paddingRight="10dp" android:text="The small rocket was launched! La la la la la la la la la la la la la..." 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 High app:stv_state_drawable_height="40dp" // Set Gif Width app:stv_state_drawable_width="40dp" // Set Gif Left Display app:stv_state_drawable_mode="left" // Set Gif Left Spacing app:stv_state_drawable_padding_left="10dp"/>
The effect is...
Now try rotating Gif 90 degrees.
<com.coorchice.library.SuperTextView ... // Set Gif to rotate 90 degrees app:stv_state_drawable_rotate="90" ... />
Rounding Gif
SuperTextView incredibly rounded Gif graphs, providing developers with more possibilities.
However, achieving this effect is surprisingly simple.
<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 the control background app:stv_drawableAsBackground="true" app:stv_scaleType="fitCenter" // Configure Gif app:stv_state_drawable="@drawable/gif_1" />
Add a border to Gif
You can even easily frame a Gif diagram.
<com.coorchice.library.SuperTextView android:layout_width="350dp" android:layout_height="148.4dp" android:layout_gravity="center_horizontal" android:gravity="center" // Add text to make it more stylistic. 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" // border-color app:stv_stroke_color="@color/opacity_8_gray_4c // 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 implementation of dynamic Avatar
In the past, some of the cool effects often stopped at the complexity and cost of implementation. SuperTextView gives you more possibilities, and your inspiration is free.
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 to Background Map app:stv_drawableAsBackground="true" // Configure Gif Avatar app:stv_state_drawable="@drawable/gif_avatar" // Add borders app:stv_stroke_color="#ffffff" app:stv_stroke_width="3dp" />
In the code, you can configure a dynamic network Avatar directly.
stv.setUrlImage("http://gif_avatar.gif");
More surprises
Both Drawable s support clicks!
In the new version of SuperTextView, Drawable1 and Drawable2 have been given new capabilities to support accurate response to click actions.
SuperTextView can accurately locate the area (Drawable1, Drawable2 or other areas) where the click action occurs by monitoring the location of the click action, and then trigger the corresponding callback monitoring.
You can set up a click action listener on Drawable for SuperTextView to make the necessary response when an 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) { // The non-Drawable area is clicked, do something... } });
Background Image Scaling Mode Support
Now, when you use Drawable1 as a background image, you can configure it with different zooming modes to achieve the desired effect.
stv.setScaleType(ScaleType.CENTER);
SuperTextView provides developers with up to three scaling modes:
-
ScaleType.FIT_XY
Stretch/compress the image tiles.
-
ScaleType.FIT_CENTER
Center the picture adaptively.
-
ScaleType.CENTER
Cut the picture in the middle. Default value.
Other updates
-
In XML layout documents, Drawable1 and Drawable2 now support setting colors directly or ShapeDrawable.
// circle_f9ad36 is a shape file written in xml app:stv_state_drawable="@drawable/circle_f9ad36" // Use pure color as Drawable app:stv_state_drawable="#000000"
- Minimum Support Version API was upgraded to 19.
- Rendering performance is at least 30% better than in the past.
- Upgrade the default image loading engine to support intelligent caching. Maybe now, you don't need to introduce a third-party image loading library.
(viii) As 5G brings faster network speed and more powerful device performance, user interfaces will increasingly need more dynamic display (in the past, a large number of static user interfaces are too dead) to stimulate users'senses and stimulate users' interest. SuperTextView can help developers easily complete the upcoming transition.
How do I start SuperTextView v3.2.1?
Add in the project build.gradle:
dependencies { ... implementation 'com.github.chenBingX:SuperTextView:v3.2.1' ... }
Portal area
- [Portal]: SuperTextView official project address
- Portal: SuperTextView Development Reference Document - You can learn how to use SuperTextView to improve the efficiency of your application construction
- Transport Portal: SuperTextView API Documentation - You can view all available APIs and properties of SuperTextView
- If you like it SuperTextView That's it. Github Point star 🌟 Support!
- CoorChice will share dried goods on the blog platform from time to time, and get in quickly. CoorChice's Personal Home Page Watch out for a wave.