Giter Site home page Giter Site logo

flowtextview's People

Contributors

jeromevdl avatar sylphem avatar thimes 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

flowtextview's Issues

Possible to extend this for EditText?

I tried making an FlowEditText that extended FlowTextView

but this didn't work because FlowTextView is missing a lot of things from an actual textview, so just putting in the EditText code in my new class didn't have anything to override and would require much greater modification and scrutiny of the FlowTextView methods.

Can you make this?

Does not support With latest Android Studio

Screen Shot 2022-05-02 at 12 50 03 PM

This is my gradle and coroutine setup:
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"

Android Studio Version:

Screen Shot 2022-05-02 at 12 51 36 PM

Not supporting RTL

I tried to set textdirection and textAlignment from xml and programitaclly but it doesn't support rtl.

Missing text すよね。

I use japanese in my app.
On some devices, FlowTextView doesn't show full text. It trims some text at the end.

layout_alignParentBottom not working

Here's my code:

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentBottom="true"
                        android:src="@drawable/fab_placeholder"
                        android:background="@color/primary_light"/>

                </uk.co.deanwild.flowtextview.FlowTextView>

The image is layed out to the upper right corner despite android:layout_alignParentBottom="true"

Support ImageSpan

It will be nice if this class also support ImageSpan with style like "float:left"

Last line of Text is cut off

In my usecase I set the Text everytime the view is created. If the text is longer than the ChildElement the last line of text is cut off.

My temporarly fix was to add a newline with two spaces after it.

I would contribue to fix this issue if you tell me to.

SpanParser should use SparseArray instead of HashMap<Integer,...

Using an older version of your library in my project and I get an Android lint warning telling me that HashMap from integer should be replaced with SparseArray and for the way you are using it SparseArray makes much more sense and should perform better.

Bug with bold html

There seems to be an issue with FlowTextView in combination with bold html. If bold html is used the last character of the text will not be visible. For example if the text is

<strong>test</strong>

it is shown as
"tes"

It's easy reproducable and it doesn't matter what child views you use in the layout.

android:TextSize attribute is not applied

The problem is inside init(Context context, AttributeSet attrs)method.
readAttrs() should be moved to the top of the method, since setTextSizeis applied before attribute is being read. This is how it should look like:

private void init(Context context, AttributeSet attrs) {
        if (attrs != null) {
            readAttrs(context, attrs);
        }
        mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.density = getResources().getDisplayMetrics().density;
        mTextPaint.setTextSize(mTextsize);
        mTextPaint.setColor(Color.BLACK);
        mLinkPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        mLinkPaint.density = getResources().getDisplayMetrics().density;
        mLinkPaint.setTextSize(mTextsize);
        mLinkPaint.setColor(Color.BLUE);
        mLinkPaint.setUnderlineText(true);
        this.setBackgroundColor(Color.TRANSPARENT);
        this.setOnTouchListener(mClickHandler);
    }

View.TEXT_DIRECTION_RTL is not working

If I use
flowTextView.setTextDirection(View.TEXT_DIRECTION_RTL);
it is not working at all

In Code:

FlowTextView flowTextView = (FlowTextView) layout.findViewById(R.id.ftv);
    imgContentSourceUrl = c.getImage();
    Ion.with(con).load(imgContentSourceUrl).intoImageView(iconimg);

                    Spanned html = Html.fromHtml(c.getContentObject());
                    flowTextView.setText(html);
                    flowTextView.setTextSize((float)30);
                    flowTextView.setTextDirection(View.TEXT_DIRECTION_RTL);
                    flowTextView.setGravity(Gravity.RIGHT);

In Xml:

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:gravity="right"
    >
    <uk.co.deanwild.flowtextview.FlowTextView
        android:id="@+id/ftv"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:textDirection="rtl"
        android:gravity="right"
        android:padding="5dip"

        android:layout_height="match_parent" >

        <ImageView
            android:id="@+id/img_icon"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:padding="10dip"
            android:src="@drawable/icon"/>


    </uk.co.deanwild.flowtextview.FlowTextView>
</RelativeLayout>

I also asked in stackoverflow:
http://stackoverflow.com/questions/38681810/android-how-to-settext-direction-rtl-in-flowtextview

Updated to newer gradle / SDK 21 - the demo app 2nd image wrapping above

Hello. I updated everything to SDK 21. Sorry I stripped out some of the maven upload stuff in name of getting it to compile. There has been rework of the syntax/etc that I didn't have time to learn. Fork here: https://github.com/RoundSparrow/FlowTextView

The problem I see: your screen shot shows text above the right image, the second image. However, my build is not dong this - it is leaving the space above the right image as blank.

Any ideas on changes in the SDK or such that we might be able to adjust for?

TextColor does not work for <b>-tag

Hi,
I am currently using a FlowTextView to display a white text. I am now trying to add bold text to it, but the new text is unfortunately not colored accordingly. Does anybody have an idea on how to achieve a white and bold text with this component?

e.g.
ftvDescription.setText(Html.fromHtml("HeadlineLorem ipsum"));
ftvDescription.setTextColor(getResources().getColor(android.R.color.white));

Hi i m facing this issue StringIndexOutOfBoundsException

java.lang.StringIndexOutOfBoundsException: length=1; regionStart=0; regionLength=2
at java.lang.String.startEndAndLength(String.java:588)
at java.lang.String.substring(String.java:1475)
at uk.co.deanwild.flowtextview.FlowTextView.onDraw(FlowTextView.java:128)

The solution for cant call OnLinkClickListener

OnLinkClickListener not call
please add fun:
public boolean onTouchEvent(MotinEvent event){
mClickHandler.onTouch(this,event);
return super.onTouchEvent(event);
} in FlowTextView.java;
and change fun
public boolean onTouch(View view,MotionEvent event){
...
if(distance < 10){
if(event_code == MotionEvent.ACTION_DOWN){
...
}
}
...
} in ClickHandler.java

onLinkClick never called

I tried to implement OnLinkClickListener to handle clicks of HTML links. Unfortunately it doesn't work. Links are highlighted correctly but onLinkClick(String url) is never called after clicking a link.

My layout hierarchy:

<ScrollView
    <LinearLayout
        <TextView />
        <View />
        <TextView />
        <View />
        <uk.co.deanwild.flowtextview.FlowTextView>
            <ImageView />
        </uk.co.deanwild.flowtextview.FlowTextView>
    </LinearLayout>
</ScrollView>

Some code:

public class RssFragment extends Fragment implements OnLinkClickListener {


    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

        // ...

        Spanned html = Html.fromHtml(rss.getSummary() + rss.getDescription(),
                new RssImageGetter(getActivity()), null);
        flowTextView.setText(html);
        flowTextView.setOnLinkClickListener(this);
    }


    @Override
    public void onLinkClick(String url) {
        Log.e("Click", url);
    }

Has anyone any idea what's wrong?

Project build failed

After adding
compile 'uk.co.deanwild:flowtextview:2.0.2@aar'
to dependencies list build is failing with:

%project_dir%%main_module_name%\build\intermediates\res\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file.
%project_dir%%main_module_name%\build\intermediates\res\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied.
Error:Execution failed for task ':actionsContentViewExample:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\dev\asdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

Any ideas how this could be solved?

Add support for sp units

It would be great if you could set the size in sp units to adapt to all kind of screen sizes/density

Resizing programmatically after creation

Hi,

I'm trying to resize the parent view of a flowtextview programmatically after creation but I end up having broken label (last line partly visible): http://snag.gy/1QGDG.jpg
(flowtextextview expands beyond the bounds of its parent view)

What's the proper way to resize the flowtextview in order to avoid this ?

Project has a manifest causing a manifer merger fail

When including the project via gradle (Android Studio):

Error:(101, 9) Attribute application@icon value=(@drawable/ic_logo) from AndroidManifest.xml:101:9
Error:(103, 9) Attribute application@theme value=(@style/Theme.XXXX) from AndroidManifest.xml:103:9
is also present at uk.co.deanwild:flowtextview:2.0.2:14:9 value=(@style/AppTheme)
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:97:5 to override

(Not critical, The error it self has a override suggestion)

The Source manifest conflicts with the library

Hi,

I am using the latest version of gradle. While building my project with you library I cam across this error.

Error:(26, 9) Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@icon value=(@drawable/app_icon) from AndroidManifest.xml:26:9
is also present at uk.co.deanwild:flowtextview:2.0.2:12:9 value=(@drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to element at AndroidManifest.xml:24:5 to override

The Solution to the same is also given along . I thought of sharing it so that you can make necessary changes for future .

Regards,

ic_action_search included in archive?

I'm trying to use v2.0.2 of the library, but I'm getting a resource conflict with the ic_action_search image, as I'm including that in my res directory. Is this actually needed by the library, and if not, can it be removed?

/Users/robert/AndroidStudioProjects//app/build/intermediates/res/debug/drawable-hdpi-v4/ic_action_search.png: error: Duplicate file.

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.