MCPcopy Index your code
hub / github.com/deano2390/FlowTextView

github.com/deano2390/FlowTextView @2.0.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.0.5 ↗ · + Follow
73 symbols 155 edges 12 files 11 documented · 15%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FlowTextView

A wrapping TextView for Android

I originally uploaded this project on Google code over 2 years ago but I left it to rot and never maintained it so I decided to 'hub it and start refactoring it. Pull requests welcome!

Logo

A TextView that extends RelativeLayout. The text will wrap around any child views inside the layout.

This widget has basic support for HTML using Html.fromHtml("< your markup ... />") It will recognise links, bold italic etc.

How to use

Add to your XML layout with your child views inside it:

<uk.co.deanwild.flowtextview.FlowTextView
    android:id="@+id/ftv"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:padding="10dip"
            android:src="https://github.com/deano2390/FlowTextView/raw/2.0.5/@drawable/android"/>

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginTop="400dip"
            android:padding="10dip"
            android:src="https://github.com/deano2390/FlowTextView/raw/2.0.5/@drawable/android2"/>
</uk.co.deanwild.flowtextview.FlowTextView>

Then in your code:

        FlowTextView flowTextView = (FlowTextView) findViewById(R.id.ftv);
        Spanned html = Html.fromHtml("<html>Your html goes here....");
        flowTextView.setText(html);

Gradle

Add jitpack to your your build.gradle at the end of repositories:

repositories {
        // ...
        maven { url "https://jitpack.io" }
    }

Add the dependency:

compile 'com.github.deano2390:FlowTextView:2.0.4'

License

Copyright 2014 Dean Wild

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.

History

I needed to have a text wrap around images and other views in an Android App but I was surprised and frustrated to discover that there was no way to do this natively.

The general consensus was that the only practical way to achieve this was to use WebViews.

Using webviews is a bit bloaty and overkill to achieve this. We lose the direct control and performance of using native widgets.

So I developed a native widget which extends RelativeLayout (I figured this was more versatile than LinearLayout) which is capable of painting text around its child views.

The code is still a little rough and I suspect it could be vastly improved in many areas but it seems to work quite well.

TODO

  • Add support for parameters to be supplied directly in XML layout.

  • Improve HTML support. For now it can handle basic tags like bold, italic, break and a href but it would be nice to support everything

  • Add support for Right to Left text printing.

  • Performance - this can always be improved. The larger the text content the slower this beast gets at the moment. Perhaps ART might do the trick though

Extension points exported contracts — how you extend this code

OnLinkClickListener (Interface)
Created by Dean on 24/06/2014. [2 implementers]
flowtextview/src/main/java/uk/co/deanwild/flowtextview/listeners/OnLinkClickListener.java

Core symbols most depended-on inside this repo

invalidate
called by 9
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
setTextSize
called by 6
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
init
called by 3
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
getTextsize
called by 3
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
setColor
called by 3
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
getLineHeight
called by 3
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
getColor
called by 2
flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java
parseSpan
called by 2
flowtextview/src/main/java/uk/co/deanwild/flowtextview/helpers/SpanParser.java

Shape

Method 61
Class 11
Interface 1

Languages

Java100%

Modules by API surface

flowtextview/src/main/java/uk/co/deanwild/flowtextview/FlowTextView.java29 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/helpers/SpanParser.java14 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/helpers/ClickHandler.java8 symbols
flowtextview-sample/src/main/java/uk/co/deanwild/flowtextview/sample/MainActivity.java7 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/helpers/PaintHelper.java4 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/models/HtmlObject.java2 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/models/HtmlLink.java2 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/listeners/OnLinkClickListener.java2 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/helpers/CollisionHelper.java2 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/models/Obstacle.java1 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/models/Line.java1 symbols
flowtextview/src/main/java/uk/co/deanwild/flowtextview/models/Area.java1 symbols

For agents

$ claude mcp add FlowTextView \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact