Skip to content

How Can I Show Image with text in AreTextView, PLease - #150

Open
shagorjhon wants to merge 118 commits into
toolbar-refafrom
master
Open

How Can I Show Image with text in AreTextView, PLease #150
shagorjhon wants to merge 118 commits into
toolbar-refafrom
master

Conversation

@shagorjhon

Copy link
Copy Markdown

There is show only text and formatted text, but the image not showing. please fix this or suggest me. thank you

viewModel.getListLiveData().observe(this, new Observer<List<ModelClass>>() { @Override public void onChanged(List<ModelClass> modelClasses) { titleShow.setText(modelClasses.get(position).getTitle()); areTextView.setText(Html.fromHtml(modelClasses.get(position).getContent())); id = modelClasses.get(position).getId(); } });

`@Override
protected void onActivityResult(int requestCode, int resultCode, @nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == EDIT_NOTE_REQUEST_CODE && data!=null ){
String titleTxt = data.getStringExtra(EditNote.EDIT_NOTE_TITLE);
String contentTxt = data.getStringExtra(EditNote.EDIT_NOTE_CONTENT);
String dateTxt = data.getStringExtra(EditNote.EDIT_NOTE_DATE);

        ModelClass modelClass = new ModelClass(titleTxt,contentTxt,dateTxt);
        modelClass.setId(id);
        viewModel.update(modelClass);
    }
}`

@chinalwb

Copy link
Copy Markdown
Owner

Hi @shagorjhon , regarding this RP, are you fixing the issue you ran into or, you'd like me to look into the issue and release a new version?

chinalwb and others added 10 commits March 9, 2023 15:45
ISSUE: wrong numbering for nested Ordered list.
Block styles resolved their range through Util.getCurrentCursorLine /
getThisLineStart / getThisLineEnd, which read the Layout. A Layout line is a
visual line, so a wrapped paragraph reported its wrap point as its boundary:
quoting a 130 character paragraph styled only its first 13 characters. The
same helpers also returned stale offsets right after an edit, which is exactly
when the list styles ask for them, and walked back one character too far on a
wrapped line. They are now computed from the text, so they describe paragraphs
and need no Layout. This fixes list, quote, alignment and indent alike.

Ordered list numbers are recomputed for the whole document by the new
ARE_ListNumbering instead of being patched up span by span: the old walk
inspected a two character window and trusted Editable#getSpans to return
document order, which it never does. Numbering restarts at 1 when a paragraph
with content interrupts the run, and each nesting level is numbered on its own
so an outer list carries on across a sublist.

Also fixed, in both the fixed and the composable style hierarchies:

- an ArrayIndexOutOfBounds when the newline between two list items was
  deleted: the branches were inverted and the else indexed an empty array
- toggling a list item off left its zero width marker behind, and the
  bullet/number conversion deleted nothing at all - delete(x + 1, x + 1) - so
  each conversion stacked up one more invisible character
- isEmptyListItemSpan tested for length 2, which is wrong for the last item of
  a list, as it has no trailing newline
- the previous item was looked up two characters back, going negative at the
  start of the text
- ARE_ABS_Style could call setSpan with end before start on an empty span

List markers are drawn right aligned in their margin, so a two digit number no
longer collides with the text, and the RTL offset is dir * margin rather than
dir + margin.

Instrumentation tests could not compile - they still used the pre-AndroidX
android.support.test - so they are migrated and given the AndroidX test
dependencies, with a kotlin-bom to stop androidx.test pulling a stdlib that
dexes to duplicate classes. Editors are built on a TestHostActivity because
AREditText resolves its padding by walking the context chain up to an Activity.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JDn8yv8TMAmWvzeVerPXqH
Every toolbar icon was a single hdpi PNG, so on any modern device they were
upscaled and blurry, and they ranged from 54 to 1024 pixels in a mix of visual
styles. The buttons around them were 30, 35 or 40dp, which is why the row
looked ragged, and the 30dp ones were below the minimum touch target. None of
them had a content description, so screen readers announced nothing.

They are replaced by 26 vector drawables on a 24dp grid with a single weight.
The letterforms are real glyph outlines, so B, I, U, S, A and the list digits
share one typeface rather than each being drawn its own way. Buttons are now a
48dp touch target holding a 24dp icon, built by the new
ARE_ToolItem_Abstract#createToolItemView, which also removes the same twenty
copies of the view construction and supplies the content description.

The icons are monochrome and tinted at runtime, so a host app restyles the
toolbar by overriding the are_toolbar_* / are_tool_item_* colour resources. An
active style is now the button's selected state - a soft rounded chip - rather
than a full bleed block of hot pink painted directly onto the view. There were
two independent code paths doing that painting, ARE_Helper and
ARE_ToolItem_UpdaterDefault; both now only call setSelected, and the updater's
colour arguments are deprecated.

ARE_ToolbarDefault fills in a neutral surface when the host gave it no
background of its own, since the icon set is drawn for a surface and would
otherwise land on whatever the theme paints. Setting android:background still
wins.

The 30 superseded PNGs are deleted, which takes the drawable directories from
732KB to 552KB. The demo is brought onto the same grid: its custom bold button
now goes through createToolItemView, which is the recommended way to add a tool
item, while the YouTube one keeps its own view to show a full colour brand mark
still lines up.

tools/icons holds the generator. The committed XML is what the build uses; the
scripts are there so the set can be extended without hand-drawing paths.
IconSheetTest fails on an icon that cannot be inflated and writes a contact
sheet of the whole set so it can be compared side by side.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JDn8yv8TMAmWvzeVerPXqH
A document that was opened and saved without being edited did not come back the
same. Every cycle grew, without bound, and none of the twenty kinds of markup
tried round tripped cleanly.

The newline that ends the last paragraph was written out as a <br>, which was
parsed back into another trailing newline, which was written out as two <br>,
and so on: a blank line appeared at the end of the document on every save. A
newline ends the last paragraph rather than opening an empty one after it.

Closing a list counted its paragraph break twice. The close tag already
produces that break when the html is read back, so writing a <br> for the empty
paragraph it leaves behind added a line each cycle. The same held for the run
of text after a closed blockquote.

The zero width space that marks a list item was written into the exported html.
getHtml strips the escaped form, but escapeCJK is off by default - correctly,
or CJK text would be turned into entities - so the marker went out as a raw
U+200B and the strip never matched. It is an editing aid and is now skipped
when writing text out; the parser puts it back when the list is read again.

<hr> was wrapped in a <p>, which is invalid html. Parsers restructure it on the
way back in, which left a stray space inside the paragraph on every trip. It is
written on its own now, with no trailing whitespace, as a rule has nothing to
hang that whitespace on.

Character style spans are sorted before being written, because getSpans returns
them in insertion order: the same document could be written as <b><i> one time
and <i><b> the next. Exports are reproducible now, which is what lets saved
documents be diffed.

HtmlRoundTripTest covers twenty kinds of markup and asserts both halves of the
contract: the formatting survives, and the trip is a fixed point over five
cycles with no editing markers in the output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JDn8yv8TMAmWvzeVerPXqH
Notes the architecture that takes reading several files to see: the two
parallel style hierarchies, the paragraph boundary and list numbering
invariants, the html round trip contract, the icon system, and the constraint
that instrumentation tests need a real Activity.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JDn8yv8TMAmWvzeVerPXqH
Fix list editing, unify the toolbar icons, and make html round trips stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants