├── .gitignore ├── CODE_OF_CONDUCT.md ├── README.md ├── RichTextExample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── io │ │ └── square1 │ │ └── richtext │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── fonts │ │ ├── GreatVibes-Regular.otf │ │ ├── IndieFlower.ttf │ │ ├── SourceCodePro-Black.ttf │ │ ├── SourceCodePro-Bold.ttf │ │ ├── SourceCodePro-ExtraLight.ttf │ │ ├── SourceCodePro-Light.ttf │ │ ├── SourceCodePro-Medium.ttf │ │ ├── SourceCodePro-Regular.ttf │ │ ├── SourceCodePro-Semibold.ttf │ │ ├── Vegur-Bold.otf │ │ ├── Vegur-Light.otf │ │ ├── Vegur-Regular.otf │ │ └── Velino_Text-Bold.otf │ └── samples │ │ ├── html5.html │ │ ├── test.html │ │ └── youtube_test.html │ ├── java │ └── io │ │ └── square1 │ │ └── richtext │ │ └── io │ │ └── square1 │ │ └── richtext │ │ └── sample │ │ ├── ContentAdapter.java │ │ ├── ContentFragment.java │ │ ├── GlideTarget.java │ │ ├── HtmlParserExampleFragment.java │ │ ├── HtmlParserSplitElementsExampleFragment.java │ │ ├── HtmlTestParseFragment.java │ │ ├── Main2Activity.java │ │ ├── MainActivity.java │ │ ├── MyVideoRecyclerViewAdapter.java │ │ ├── NavigationDrawerFragment.java │ │ ├── TextBuilderExampleFragment.java │ │ ├── UriAdapter.java │ │ ├── Utils.java │ │ ├── VideoListFragment.java │ │ └── VideoTestFragment.java │ └── res │ ├── drawable-hdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-mdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-xhdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-xxhdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-xxxhdpi │ └── quote2.png │ ├── layout │ ├── activity_main.xml │ ├── activity_main2.xml │ ├── activity_main_activity2.xml │ ├── activity_main_old.xml │ ├── drawer_main.xml │ ├── fragment_list_main.xml │ ├── fragment_text_builder_example.xml │ ├── fragment_video.xml │ ├── fragment_video_item.xml │ ├── fragment_video_list.xml │ ├── fragment_video_test.xml │ └── text_view.xml │ ├── menu │ ├── global.xml │ ├── main.xml │ ├── menu_main.xml │ └── menu_main_activity2.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── bitbucket-pipelines.yml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── resources ├── sample-text-rendered.gif └── sample-text-rendered.mp4 ├── richtext ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── io │ │ └── square1 │ │ ├── oembed │ │ ├── Oembed.java │ │ ├── OembedCache.java │ │ └── OembedViewHolder.java │ │ ├── parcelable │ │ ├── DynamicParcelable.java │ │ ├── DynamicParcelableCreator.java │ │ ├── ParcelableCreator.java │ │ └── ParcelableUtil.java │ │ └── richtextlib │ │ ├── EmbedUtils.java │ │ ├── spans │ │ ├── AbsoluteSizeSpan.java │ │ ├── BackgroundColorSpan.java │ │ ├── BitmapSpan.java │ │ ├── BoldSpan.java │ │ ├── BulletSpan.java │ │ ├── ClickableSpan.java │ │ ├── ForegroundColorSpan.java │ │ ├── HeaderSpan.java │ │ ├── ItalicSpan.java │ │ ├── LeadingMarginSpan.java │ │ ├── QuoteSpan.java │ │ ├── RelativeSizeSpan.java │ │ ├── RemoteBitmapSpan.java │ │ ├── RichAlignmentSpan.java │ │ ├── RichTextSpan.java │ │ ├── SpanUtil.java │ │ ├── StrikethroughSpan.java │ │ ├── Style.java │ │ ├── StyleSpan.java │ │ ├── SubscriptSpan.java │ │ ├── SuperscriptSpan.java │ │ ├── TextAppearanceSpan.java │ │ ├── TypefaceSpan.java │ │ ├── URLSpan.java │ │ ├── UnderlineSpan.java │ │ ├── UnsupportedContentSpan.java │ │ ├── UrlBitmapDownloader.java │ │ ├── UrlBitmapSpan.java │ │ ├── VideoPlayerSpan.java │ │ ├── VideoPlayerSpanOLD.java │ │ └── YouTubeSpan.java │ │ ├── ui │ │ ├── Appearance.java │ │ ├── AspectRatioFrameLayout.java │ │ ├── FallbackWebDialog.java │ │ ├── RichContentView.java │ │ ├── RichContentViewDisplay.java │ │ ├── audio │ │ │ ├── AudioPlayer.java │ │ │ ├── AudioPlayerHolder.java │ │ │ ├── Media.java │ │ │ └── PlayerListener.java │ │ ├── video │ │ │ ├── FullScreenVideoFragment.java │ │ │ ├── InternalMediaPlayer.java │ │ │ ├── MediaPlayerPool.java │ │ │ ├── RichMediaPlayer.java │ │ │ ├── RichVideoView.java │ │ │ └── VideoControls.java │ │ └── web │ │ │ ├── VideoEnabledWebChromeClient.java │ │ │ ├── WebContentHolder.java │ │ │ └── WrapContentWebView.java │ │ ├── util │ │ ├── ArrayUtils.java │ │ ├── CatchAndLog.java │ │ ├── NumberUtils.java │ │ ├── Size.java │ │ ├── UniqueId.java │ │ ├── Utils.java │ │ └── WebAddress.java │ │ └── v2 │ │ ├── RichTextV2.java │ │ ├── content │ │ ├── DocumentElement.java │ │ ├── ImageDocumentElement.java │ │ ├── OembedDocumentElement.java │ │ ├── RichDocument.java │ │ ├── RichTextDocumentElement.java │ │ ├── VideoDocumentElement.java │ │ └── WebDocumentElement.java │ │ ├── parser │ │ ├── InternalContentHandler.java │ │ ├── MarkupContext.java │ │ ├── MarkupTag.java │ │ ├── TagHandler.java │ │ ├── advanced │ │ │ ├── AdvancedMarkupContext.java │ │ │ ├── facebook │ │ │ │ ├── FacebookContext.java │ │ │ │ └── FacebookDivTagHandler.java │ │ │ ├── instagram │ │ │ │ ├── InstagramContext.java │ │ │ │ ├── InstagramLinkTagHandler.java │ │ │ │ └── InstagramQuoteTagHandler.java │ │ │ └── twitter │ │ │ │ ├── TwitterContext.java │ │ │ │ ├── TwitterLinkTagHandler.java │ │ │ │ └── TwitterQuoteTagHandler.java │ │ └── handlers │ │ │ ├── AHandler.java │ │ │ ├── AUDIOHandler.java │ │ │ ├── AppendContentHandler.java │ │ │ ├── BHandler.java │ │ │ ├── BIGHandler.java │ │ │ ├── BLOCKQUOTEHandler.java │ │ │ ├── BRHandler.java │ │ │ ├── BaseListHandler.java │ │ │ ├── CITEHandler.java │ │ │ ├── CODEHandler.java │ │ │ ├── DDHandler.java │ │ │ ├── DELHandler.java │ │ │ ├── DFNHandler.java │ │ │ ├── DIVHandler.java │ │ │ ├── DLHandler.java │ │ │ ├── DTHandler.java │ │ │ ├── DefaultHandler.java │ │ │ ├── EMHandler.java │ │ │ ├── FONTHandler.java │ │ │ ├── H1Handler.java │ │ │ ├── H2Handler.java │ │ │ ├── H3Handler.java │ │ │ ├── H4Handler.java │ │ │ ├── H5Handler.java │ │ │ ├── H6Handler.java │ │ │ ├── HeaderBaseHandler.java │ │ │ ├── IFRAMEHandler.java │ │ │ ├── IHandler.java │ │ │ ├── IMGHandler.java │ │ │ ├── IgnoreContentHandler.java │ │ │ ├── LIHandler.java │ │ │ ├── Markers.java │ │ │ ├── OLHandler.java │ │ │ ├── PHandler.java │ │ │ ├── SCRIPTHandler.java │ │ │ ├── SHandler.java │ │ │ ├── SMALLHandler.java │ │ │ ├── SOUNDCLOUDHandler.java │ │ │ ├── SOURCEHandler.java │ │ │ ├── STRONGHandler.java │ │ │ ├── STYLEHandler.java │ │ │ ├── SUBHandler.java │ │ │ ├── SUPHandler.java │ │ │ ├── TTHandler.java │ │ │ ├── UHandler.java │ │ │ ├── ULHandler.java │ │ │ └── VIDEOHandler.java │ │ └── utils │ │ ├── SpanUtils.java │ │ └── SpannedBuilderUtils.java │ └── res │ ├── drawable-xhdpi │ ├── close.png │ ├── fa_play_circle.png │ ├── image.png │ ├── instagram_logo.png │ ├── placeholder.png │ ├── quote.png │ ├── vimeo_play.png │ ├── vine_logo.png │ └── youtube_play.png │ ├── drawable-xxhdpi │ ├── fullscreen_enter.png │ ├── fullscreen_exit.png │ └── place_holder_twitter.png │ ├── drawable │ └── place_holder_twitter_xml.xml │ ├── layout │ ├── internal_richtext_fragment_full_screen_video.xml │ ├── internal_richtext_video_controller.xml │ ├── internal_richtext_video_display.xml │ ├── rich_text_embed_layout_media_player.xml │ ├── rich_text_embed_layout_oembed.xml │ ├── rich_text_embed_layout_twitter_container.xml │ ├── rich_text_embed_layout_webview.xml │ └── test_rich_video_view.xml │ └── values │ ├── attr.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── settings.gradle └── version.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | richtextlib/richtextlib.iml 9 | 10 | # Built application files 11 | *.apk 12 | *.ap_ 13 | 14 | # Files for the Dalvik VM 15 | *.dex 16 | 17 | # Java class files 18 | *.class 19 | 20 | # Generated files 21 | bin/ 22 | gen/ 23 | 24 | # Gradle files 25 | .gradle/ 26 | build/ 27 | /*/build/ 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.logRichTextExample/build/generated RichTextExample/build/intermediates RichTextExample/build/outputs RichTextExample/build/tmp 37 | RichTextExample/build 38 | .idea 39 | richtext/richtext.iml 40 | RichTextExample/build/ 41 | .idea/ 42 | RichTextExample/RichTextExample.iml 43 | RichText.iml 44 | -------------------------------------------------------------------------------- /RichTextExample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /RichTextExample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | def appLibs = rootProject.ext.appLibraries; 4 | 5 | android { 6 | compileSdkVersion 26 7 | buildToolsVersion '26.0.2' 8 | 9 | defaultConfig { 10 | applicationId "io.square1.richtext" 11 | minSdkVersion 15 12 | targetSdkVersion 26 13 | versionCode 1 14 | versionName "1.0" 15 | } 16 | buildTypes { 17 | release { 18 | buildConfigField "boolean", "publishedSample", "false" 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | lintOptions { 24 | abortOnError false 25 | } 26 | 27 | } 28 | 29 | dependencies { 30 | compile fileTree(include: ['*.jar'], dir: 'libs') 31 | compile project(':richtext') 32 | compile "org.ccil.cowan.tagsoup:tagsoup:${appLibs.TAGSOUP_VERSION}" 33 | compile "com.github.bumptech.glide:glide:${appLibs.GLIDE_VERSION}" 34 | compile "com.android.support:support-annotations:${appLibs.ANDROID_SUPPORT_VERSION}" 35 | compile "com.android.support:support-v4:${appLibs.ANDROID_SUPPORT_VERSION}" 36 | compile "com.android.support:appcompat-v7:${appLibs.ANDROID_SUPPORT_VERSION}" 37 | compile "com.android.support:recyclerview-v7:${appLibs.ANDROID_SUPPORT_VERSION}" 38 | } 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /RichTextExample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/roberto/android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /RichTextExample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/GreatVibes-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/GreatVibes-Regular.otf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/IndieFlower.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/IndieFlower.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-Black.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-Bold.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-ExtraLight.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-Light.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-Medium.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/SourceCodePro-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/SourceCodePro-Semibold.ttf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/Vegur-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/Vegur-Bold.otf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/Vegur-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/Vegur-Light.otf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/Vegur-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/Vegur-Regular.otf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/fonts/Velino_Text-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/assets/fonts/Velino_Text-Bold.otf -------------------------------------------------------------------------------- /RichTextExample/src/main/assets/samples/test.html: -------------------------------------------------------------------------------- 1 |

David Bowie returned to our screens last night by making a surprise appearance in the latest episode of Twin Peaks.

2 |

With only four episodes to go until Twin Peaks season three is wrapped up, David Lynch is revisiting old characters that were supposed to have expanded roles in the latest chapter of his bizarre mystery.

3 |

The latest episode was also dedicated to Bowie.

4 |

hello https://twitter.com/TheFilmStage/status/896903098060349440

5 |

The footage of Bowie was taken from his role in the 1992 Twin Peaks prequel movie, Twin Peaks: Fire Walk With Me. Bowie played FBI agent Phillip Jeffries in the show.

6 |

Previously, Harry Goaz, an actor on the show, revealed in an interview that David Bowie, who had a small role in the 1992 film spin off Twin Peaks: Fire Walk With Me, was set to return to make a cameo, but it didn’t happen before the musician’s death last year.

7 |

Lynch nevertheless included him in the latest episode, using Fire Walk With Me footage in a dream sequence.

8 |

The appearance puts Bowie in the company of numerous other musical guest stars in the current series, including Moby, Nine Inch Nails, Sky Ferreira and Hudson Mohawke.

9 |

Fans were delighted and emotional about the reunion.

10 |
some more content after the audio !
-------------------------------------------------------------------------------- /RichTextExample/src/main/assets/samples/youtube_test.html: -------------------------------------------------------------------------------- 1 |

James Cameron’s multi Oscar Winning epic action/sci-fi masterpiece, TERMINATOR 2 | 2: JUDGMENT DAY will return to cinemas from August 29th in 3 | a breath-taking new 3D conversion overseen by James Cameron himself.

4 |

To celebrate the new release Marty & Conor are giving 5 | away €500 to the person who can do the best Arnie Terminator 2 impersonation. Send in a video of 6 | you doing your best line from the movie 7 | APP them on 087 18 18 100.

8 | 11 |

Along with the €500 that will be given away on 12 | “Judgement Day: August 29”, there is also 5 runner up merch packs up for grabs which 13 | include a Quad -Blu-ray bundle: Robocop, Total Recall, Non-Stop – Official T2 t-shirt and 14 | tickets to see TERMINATOR 2: JUDGMENT DAY 3D

Having 15 | originally hit screens in 1991, complete with groundbreaking special effects, TERMINATOR 16 | 2: JUDGMENT DAY became Arnold Schwarzenegger’s most iconic role to 17 | date, as well as one of the most quotable scripts of the decade. This brand new 3D version will 18 | blast the seminal blockbuster into the 21st century and introduce it to a brand new generation 19 | of fans.

-------------------------------------------------------------------------------- /RichTextExample/src/main/java/io/square1/richtext/io/square1/richtext/sample/GlideTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Roberto Prato 3 | * 4 | * * 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package io.square1.richtext.io.square1.richtext.sample; 21 | 22 | import android.content.Context; 23 | 24 | import com.bumptech.glide.load.resource.drawable.GlideDrawable; 25 | import com.bumptech.glide.request.animation.GlideAnimation; 26 | import com.bumptech.glide.request.target.SimpleTarget; 27 | 28 | import io.square1.richtextlib.spans.RemoteBitmapSpan; 29 | 30 | public class GlideTarget extends SimpleTarget { 31 | 32 | private RemoteBitmapSpan mSpan; 33 | private Context mApplicationContext; 34 | 35 | public GlideTarget(Context context, RemoteBitmapSpan span){ 36 | this.mSpan = span; 37 | mApplicationContext = context.getApplicationContext(); 38 | } 39 | 40 | @Override 41 | public void onResourceReady(GlideDrawable resource, GlideAnimation glideAnimation) { 42 | mSpan.updateBitmap(mApplicationContext, resource); 43 | } 44 | } -------------------------------------------------------------------------------- /RichTextExample/src/main/java/io/square1/richtext/io/square1/richtext/sample/Main2Activity.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package io.square1.richtext.io.square1.richtext.sample; 4 | 5 | import android.app.Activity; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.graphics.Color; 9 | import android.support.annotation.ColorInt; 10 | import android.support.v4.app.FragmentActivity; 11 | import android.os.Bundle; 12 | import android.text.SpannableStringBuilder; 13 | import android.text.Spanned; 14 | 15 | import io.square1.richtext.R; 16 | import io.square1.richtextlib.spans.BackgroundColorSpan; 17 | import io.square1.richtextlib.spans.URLSpan; 18 | import io.square1.richtextlib.ui.RichContentView; 19 | import io.square1.richtextlib.v2.content.RichDocument; 20 | import io.square1.richtextlib.v2.content.RichTextDocumentElement; 21 | 22 | public class Main2Activity extends FragmentActivity { 23 | 24 | public static void showDocument(RichDocument document , Activity context){ 25 | Intent intent = new Intent(context, Main2Activity.class); 26 | intent.putExtra("doc", document); 27 | context.startActivity(intent); 28 | 29 | } 30 | 31 | @Override 32 | protected void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.activity_main2); 35 | 36 | RichContentView richContentView = (io.square1.richtextlib.ui.RichContentView)findViewById(R.id.content); 37 | RichDocument richDocument = getIntent().getParcelableExtra("doc"); 38 | richContentView.setText((RichTextDocumentElement) richDocument.getElements().get(0)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RichTextExample/src/main/java/io/square1/richtext/io/square1/richtext/sample/MyVideoRecyclerViewAdapter.java: -------------------------------------------------------------------------------- 1 | package io.square1.richtext.io.square1.richtext.sample; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | 9 | import java.util.List; 10 | 11 | import io.square1.richtext.R; 12 | import io.square1.richtextlib.ui.video.RichVideoView; 13 | 14 | 15 | public class MyVideoRecyclerViewAdapter extends RecyclerView.Adapter { 16 | 17 | private final List mValues; 18 | private final VideoListFragment.OnListFragmentInteractionListener mListener; 19 | 20 | public MyVideoRecyclerViewAdapter(List items, VideoListFragment.OnListFragmentInteractionListener listener) { 21 | mValues = items; 22 | mListener = listener; 23 | } 24 | 25 | @Override 26 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 27 | View view = LayoutInflater.from(parent.getContext()) 28 | .inflate(R.layout.fragment_video_item, parent, false); 29 | return new ViewHolder(view); 30 | } 31 | 32 | @Override 33 | public void onBindViewHolder(final ViewHolder holder, int position) { 34 | holder.mItem = mValues.get(position); 35 | holder.mContentView.setData(mValues.get(position)); 36 | 37 | holder.mView.setOnClickListener(new View.OnClickListener() { 38 | @Override 39 | public void onClick(View v) { 40 | if (null != mListener) { 41 | // Notify the active callbacks interface (the activity, if the 42 | // fragment is attached to one) that an item has been selected. 43 | mListener.onListFragmentInteraction(holder.mItem); 44 | } 45 | } 46 | }); 47 | } 48 | 49 | @Override 50 | public int getItemCount() { 51 | return mValues.size(); 52 | } 53 | 54 | public class ViewHolder extends RecyclerView.ViewHolder { 55 | 56 | public final View mView; 57 | public final RichVideoView mContentView; 58 | public String mItem; 59 | 60 | public ViewHolder(View view) { 61 | super(view); 62 | mView = view; 63 | mContentView = (RichVideoView) view.findViewById(R.id.content); 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return super.toString() + " '" + mItem + "'"; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RichTextExample/src/main/java/io/square1/richtext/io/square1/richtext/sample/UriAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016. Roberto Prato 3 | * 4 | * * 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package io.square1.richtext.io.square1.richtext.sample; 21 | 22 | import android.net.Uri; 23 | import android.view.LayoutInflater; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | import android.widget.BaseAdapter; 27 | import android.widget.TextView; 28 | 29 | import java.util.ArrayList; 30 | 31 | /** 32 | * Created by roberto on 01/10/2016. 33 | */ 34 | 35 | public class UriAdapter extends BaseAdapter { 36 | 37 | private ArrayList mUri; 38 | 39 | public UriAdapter(ArrayList list){ 40 | mUri = list; 41 | } 42 | 43 | @Override 44 | public int getCount() { 45 | return mUri.size(); 46 | } 47 | 48 | @Override 49 | public Uri getItem(int position) { 50 | return mUri.get(position); 51 | } 52 | 53 | @Override 54 | public long getItemId(int position) { 55 | return position; 56 | } 57 | 58 | @Override 59 | public View getView(int position, View convertView, ViewGroup parent) { 60 | 61 | if(convertView == null) { 62 | convertView = LayoutInflater.from(parent.getContext()) 63 | .inflate(android.R.layout.simple_list_item_activated_1, parent, false); 64 | } 65 | 66 | TextView textView = (TextView)convertView.findViewById(android.R.id.text1); 67 | Uri current = mUri.get(position); 68 | textView.setText(current.getLastPathSegment()); 69 | return convertView; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RichTextExample/src/main/java/io/square1/richtext/io/square1/richtext/sample/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015. Roberto Prato 3 | * 4 | * * 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package io.square1.richtext.io.square1.richtext.sample; 21 | 22 | import android.content.Context; 23 | import android.net.Uri; 24 | 25 | import java.io.BufferedReader; 26 | import java.io.InputStream; 27 | import java.io.InputStreamReader; 28 | import java.util.List; 29 | 30 | /** 31 | * Created by roberto on 22/12/2015. 32 | */ 33 | public class Utils { 34 | 35 | public static String readFromfile(Context context, Uri file) { 36 | 37 | if("file".equalsIgnoreCase(file.getScheme())) { 38 | 39 | List segments = file.getPathSegments(); 40 | StringBuilder builder = new StringBuilder(); 41 | 42 | for (String segment : segments) { 43 | if (builder.length() > 0) { 44 | builder.append("/"); 45 | } 46 | builder.append(segment); 47 | } 48 | 49 | return readFromfile(context, builder.toString()); 50 | } 51 | 52 | return ""; 53 | } 54 | public static String readFromfile(Context context ,String fileName) { 55 | StringBuilder returnString = new StringBuilder(); 56 | InputStream fIn = null; 57 | InputStreamReader isr = null; 58 | BufferedReader input = null; 59 | try { 60 | fIn = context.getResources().getAssets() 61 | .open(fileName, Context.MODE_WORLD_READABLE); 62 | isr = new InputStreamReader(fIn); 63 | input = new BufferedReader(isr); 64 | String line = ""; 65 | while ((line = input.readLine()) != null) { 66 | returnString.append(line); 67 | } 68 | } catch (Exception e) { 69 | e.getMessage(); 70 | } finally { 71 | try { 72 | if (isr != null) 73 | isr.close(); 74 | if (fIn != null) 75 | fIn.close(); 76 | if (input != null) 77 | input.close(); 78 | } catch (Exception e2) { 79 | e2.getMessage(); 80 | } 81 | } 82 | return returnString.toString(); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-mdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-mdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-mdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-mdpi/ic_drawer.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-xhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-xhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-xxhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-xxhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-xxhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-xxhdpi/ic_drawer.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/drawable-xxxhdpi/quote2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/drawable-xxxhdpi/quote2.png -------------------------------------------------------------------------------- /RichTextExample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 15 | 16 | 17 | 19 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RichTextExample/src/main/res/layout/activity_main2.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /RichTextExample/src/main/res/layout/activity_main_activity2.xml: -------------------------------------------------------------------------------- 1 | 10 | 13 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /RichTextExample/src/main/res/layout/activity_main_old.xml: -------------------------------------------------------------------------------- 1 | 6 | 14 | 15 | 21 |