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.
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.
James Cameron’s multi Oscar Winning epic action/sci-fi masterpiece, TERMINATOR
2 | 2: JUDGMENT DAY will return to cinemas from August 29thin
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 DAY3D
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 super GlideDrawable> 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 |
26 |
27 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/drawer_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/fragment_list_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/fragment_text_builder_example.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
30 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/fragment_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
25 |
26 |
32 |
33 |
39 |
40 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/fragment_video_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/fragment_video_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/fragment_video_test.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/layout/text_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/menu/global.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/menu/menu_main_activity2.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/RichTextExample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
8 | 240dp
9 | 16dp
10 |
11 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RichText
3 |
4 | Hello world!
5 | Settings
6 | MainActivity2Activity
7 | MainActivity
8 |
9 | Section 1
10 | Section 2
11 | Section 3
12 |
13 | Open navigation drawer
14 | Close navigation drawer
15 |
16 | Example action
17 |
18 |
19 | Hello blank fragment
20 |
21 |
--------------------------------------------------------------------------------
/RichTextExample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/bitbucket-pipelines.yml:
--------------------------------------------------------------------------------
1 | # This is a sample build configuration for all languages.
2 | # Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
3 | # Only use spaces to indent your .yml configuration.
4 | # -----
5 | # You can specify a custom docker image from Docker Hub as your build environment.
6 | # image: docker-image:tag
7 |
8 | image: uber/android-build-environment
9 |
10 | # Accept all licences
11 |
12 | pipelines:
13 | default:
14 | - step:
15 | script: # Modify the commands below to build your repository.
16 | - mkdir -p "$ANDROID_HOME/licenses"
17 | - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
18 | - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
19 | - echo y | android update sdk --all --filter build-tools-24.0.0 --no-ui
20 | - echo y | android update sdk --filter "extra-android-m2repository" --no-ui -a
21 | - ./gradlew clean assemble --stacktrace
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | def getRichTextLibVersionName = { ->
4 |
5 | if(System.getenv('BUILD_DISPLAY_NAME')){
6 | def name = System.getenv('BUILD_DISPLAY_NAME');
7 | println "Richtext lib Version set to $name by Jenkins";
8 | return name;
9 | }
10 |
11 | def name = new File('version.txt').getText('UTF-8');
12 | println "Richtext lib Version set to $name by reading local version.txt";
13 | return name;
14 | }
15 |
16 | ext {
17 |
18 | //control from here the libraries versions
19 | appLibraries = [
20 | ANDROID_SUPPORT_VERSION: '26.1.0',
21 | ANDROID_EXOPLAYER_VERSION: 'r2.5.2',
22 | TAGSOUP_VERSION: '1.2',
23 | GLIDE_VERSION: '3.6.0',
24 | RICH_TEXT_VERSION: getRichTextLibVersionName()
25 | ]
26 | }
27 |
28 |
29 | buildscript {
30 | repositories {
31 | google()
32 | jcenter()
33 | }
34 | dependencies {
35 | classpath 'com.android.tools.build:gradle:3.0.1'
36 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
37 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
38 |
39 | // NOTE: Do not place your application dependencies here; they belong
40 | // in the individual module build.gradle files
41 | }
42 | }
43 |
44 | allprojects {
45 | repositories {
46 | google()
47 | mavenCentral()
48 | jcenter()
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Feb 11 17:33:49 GMT 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/resources/sample-text-rendered.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/resources/sample-text-rendered.gif
--------------------------------------------------------------------------------
/resources/sample-text-rendered.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/resources/sample-text-rendered.mp4
--------------------------------------------------------------------------------
/richtext/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/richtext/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 |
--------------------------------------------------------------------------------
/richtext/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/oembed/OembedViewHolder.java:
--------------------------------------------------------------------------------
1 | package io.square1.oembed;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.ImageView;
6 |
7 | import io.square1.richtextlib.R;
8 | import io.square1.richtextlib.spans.UrlBitmapDownloader;
9 |
10 |
11 | /**
12 | * Created by roberto on 01/10/15.
13 | */
14 | public class OembedViewHolder {
15 |
16 | public interface ImageDownloader {
17 |
18 | void load(String url,
19 | int placeHolder,
20 | ImageView imageView);
21 |
22 | }
23 |
24 | private Oembed mOembed;
25 |
26 | private ImageView mThumbNail;
27 | private ImageView mActionButton;
28 | private ImageView mProviderLogo;
29 | private ImageDownloader mImageDownloader;
30 |
31 |
32 | public OembedViewHolder(View view, ImageDownloader downloader){
33 | mThumbNail = (ImageView)view.findViewById(R.id.thumbNail);
34 | mActionButton = (ImageView)view.findViewById(R.id.actionButton);
35 | mProviderLogo = (ImageView)view.findViewById(R.id.providerLogo);
36 | mImageDownloader = downloader;
37 | }
38 |
39 |
40 |
41 | public void setOembed(Context context, String data) {
42 |
43 | Oembed current = OembedCache.getInstance().loadOembed(context, data);
44 |
45 |
46 | if( Oembed.equals(mOembed, current) == false ) {
47 |
48 | mOembed = current;
49 |
50 | mThumbNail.setImageResource(R.drawable.placeholder);
51 | mProviderLogo.setImageDrawable(null);
52 | mActionButton.setImageDrawable(null);
53 |
54 | if (mOembed != null) {
55 | //set data
56 | if(mImageDownloader != null){
57 | mImageDownloader.load(mOembed.getThumbnailUrl(),
58 | R.drawable.placeholder,
59 | mThumbNail );
60 | }
61 |
62 | String provider = mOembed.getProviderName();
63 | if ("Vimeo".equalsIgnoreCase(provider)) {
64 | mActionButton.setImageResource(R.drawable.vimeo_play);
65 | mProviderLogo.setImageDrawable(null);
66 | } else if ("Vine".equalsIgnoreCase(provider)) {
67 | mActionButton.setImageResource(R.drawable.vimeo_play);
68 | mProviderLogo.setImageResource(R.drawable.vine_logo);
69 | }
70 | if ("Instagram".equalsIgnoreCase(provider)) {
71 | mActionButton.setImageDrawable(null);
72 | mProviderLogo.setImageResource(R.drawable.instagram_logo);
73 | }
74 | }
75 | }
76 |
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/parcelable/DynamicParcelable.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.parcelable;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 |
25 | /**
26 | * Created by roberto on 04/10/15.
27 | */
28 | public interface DynamicParcelable extends Parcelable {
29 |
30 |
31 | void readFromParcel(Parcel src);
32 | }
33 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/parcelable/DynamicParcelableCreator.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.parcelable;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 | import android.util.Log;
25 |
26 | import java.lang.reflect.Array;
27 |
28 | import io.square1.richtextlib.spans.RichTextSpan;
29 | import io.square1.richtextlib.util.Utils;
30 |
31 | /**
32 | * Created by roberto on 12/06/15.
33 | */
34 | public class DynamicParcelableCreator implements Parcelable.Creator {
35 |
36 |
37 | public static DynamicParcelableCreator getInstance(Class tClass){
38 | return new DynamicParcelableCreator(tClass);
39 | }
40 |
41 | Class mType;
42 |
43 | DynamicParcelableCreator(Class tClass){
44 | mType = tClass;
45 | }
46 |
47 |
48 | @Override
49 | public T createFromParcel(Parcel source) {
50 | String type = source.readString();
51 | T obj = Utils.newInstance(type);
52 | obj.readFromParcel(source);
53 | return obj;
54 | }
55 |
56 | @Override
57 | public T[] newArray(int size) {
58 | return (T[]) Array.newInstance(mType, size);
59 | }
60 |
61 | public static void writeType(Parcel in , DynamicParcelable span){
62 | String className = span.getClass().getName();
63 | Log.i("CLASS", "-> " + className);
64 | in.writeString(className);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/parcelable/ParcelableCreator.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.parcelable;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 |
25 | import java.lang.reflect.Array;
26 |
27 | import io.square1.richtextlib.util.Utils;
28 |
29 | /**
30 | * Created by roberto on 20/09/2016.
31 | */
32 |
33 | public class ParcelableCreator implements Parcelable.Creator {
34 |
35 | private Class mClass;
36 |
37 | public ParcelableCreator(Class tClass){
38 | mClass = tClass;
39 | }
40 |
41 | @Override
42 | public T createFromParcel(Parcel source) {
43 | T newInstance = Utils.newInstance(mClass);
44 | newInstance.readFromParcel(source);
45 | return newInstance;
46 | }
47 |
48 | @Override
49 | public T[] newArray(int size) {
50 | return (T[]) Array.newInstance(mClass, size);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/parcelable/ParcelableUtil.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.parcelable;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 |
25 | public class ParcelableUtil {
26 |
27 | public static byte[] marshall(Parcelable parcelable) {
28 | Parcel parcel = Parcel.obtain();
29 | parcel.setDataPosition(0);
30 | parcelable.writeToParcel(parcel,0);
31 | byte[] bytes = parcel.marshall();
32 | parcel.recycle(); // not sure if needed or a good idea
33 | return bytes;
34 | }
35 |
36 | public static Parcel unMarshall(byte[] bytes) {
37 | Parcel p = Parcel.obtain();
38 | p.setDataPosition(0);
39 | p.unmarshall(bytes,0,bytes.length);
40 | p.setDataPosition(0);
41 | return p;
42 | }
43 |
44 | public static T unMarshall(byte[] bytes, Parcelable.Creator creator) {
45 | Parcel parcel = unMarshall(bytes);
46 | return creator.createFromParcel(parcel);
47 | }
48 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/BoldSpan.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.spans;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.parcelable.DynamicParcelableCreator;
25 | import io.square1.richtextlib.util.UniqueId;
26 |
27 | /**
28 | * Created by roberto on 31/07/2017.
29 | */
30 |
31 | public class BoldSpan extends StyleSpan {
32 |
33 | public static final Creator CREATOR = DynamicParcelableCreator.getInstance(BoldSpan.class);
34 |
35 | public static final int TYPE = UniqueId.getType();
36 |
37 | public BoldSpan() {
38 | super(Typeface.BOLD);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/ClickableSpan.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.richtextlib.spans;
21 |
22 | /**
23 | * Created by roberto on 26/06/15.
24 | */
25 | public interface ClickableSpan {
26 |
27 |
28 | String getAction();
29 | }
30 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/ItalicSpan.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.spans;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.parcelable.DynamicParcelableCreator;
25 | import io.square1.richtextlib.util.UniqueId;
26 |
27 | /**
28 | * Created by roberto on 31/07/2017.
29 | */
30 |
31 | public class ItalicSpan extends StyleSpan {
32 |
33 | public static final Creator CREATOR = DynamicParcelableCreator.getInstance(ItalicSpan.class);
34 |
35 | public static final int TYPE = UniqueId.getType();
36 |
37 | public ItalicSpan() {
38 | super(Typeface.ITALIC);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/RemoteBitmapSpan.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.richtextlib.spans;
21 |
22 | import android.content.Context;
23 | import android.graphics.Rect;
24 | import android.graphics.drawable.Drawable;
25 |
26 | /**
27 | * Created by roberto on 30/06/15.
28 | */
29 | public interface RemoteBitmapSpan {
30 | void updateBitmap(Context context, Drawable bitmap);
31 | Rect getPossibleSize();
32 | }
33 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/RichTextSpan.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.richtextlib.spans;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 | import android.view.View;
25 |
26 | import io.square1.parcelable.DynamicParcelable;
27 | import io.square1.richtextlib.ui.RichContentView;
28 | import io.square1.richtextlib.ui.RichContentViewDisplay;
29 | import io.square1.richtextlib.util.Utils;
30 |
31 | /**
32 | * Created by roberto on 12/06/15.
33 | */
34 | public interface RichTextSpan extends DynamicParcelable , View.OnAttachStateChangeListener {
35 |
36 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
37 |
38 |
39 | @Override
40 | public RichTextSpan createFromParcel(Parcel source) {
41 | String type = source.readString();
42 | RichTextSpan obj = Utils.newInstance(type);
43 | obj.readFromParcel(source);
44 | return obj;
45 | }
46 |
47 | @Override
48 | public RichTextSpan[] newArray(int size) {
49 | return new RichTextSpan[size];
50 | }
51 | };
52 |
53 | int getType();
54 | /// void setType(int type);
55 |
56 |
57 | void onSpannedSetToView(RichContentView view);
58 | void onAttachedToWindow(RichContentViewDisplay view);
59 | void onDetachedFromWindow(RichContentViewDisplay view);
60 |
61 |
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/SpanUtil.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.richtextlib.spans;
21 |
22 | import java.lang.ref.WeakReference;
23 |
24 | import io.square1.richtextlib.ui.RichContentView;
25 | import io.square1.richtextlib.ui.RichContentViewDisplay;
26 |
27 | /**
28 | * Created by roberto on 30/09/15.
29 | */
30 | public class SpanUtil {
31 |
32 | public static UrlBitmapDownloader get(WeakReference viewWeakReference) {
33 |
34 | if(viewWeakReference == null) return null;
35 |
36 | RichContentView view = viewWeakReference.get();
37 |
38 | if(view != null) return view.getDownloader();
39 |
40 | return null;
41 |
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/StrikethroughSpan.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.richtextlib.spans;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 | import android.text.TextPaint;
25 | import android.text.style.CharacterStyle;
26 | import android.text.style.UpdateAppearance;
27 | import android.view.View;
28 |
29 | import io.square1.parcelable.DynamicParcelableCreator;
30 | import io.square1.richtextlib.ui.RichContentView;
31 | import io.square1.richtextlib.ui.RichContentViewDisplay;
32 | import io.square1.richtextlib.util.UniqueId;
33 |
34 | public class StrikethroughSpan extends CharacterStyle implements UpdateAppearance , RichTextSpan {
35 |
36 | public static final Parcelable.Creator CREATOR = DynamicParcelableCreator.getInstance(RelativeSizeSpan.class);
37 |
38 | public static final int TYPE = UniqueId.getType();
39 |
40 | @Override
41 | public int getType() {
42 | return TYPE;
43 | }
44 |
45 | public StrikethroughSpan() {
46 | }
47 |
48 | public StrikethroughSpan(Parcel src) {
49 | }
50 |
51 |
52 |
53 | public int describeContents() {
54 | return 0;
55 | }
56 |
57 | public void writeToParcel(Parcel dest, int flags) {
58 | DynamicParcelableCreator.writeType(dest, this);
59 | }
60 |
61 | @Override
62 | public void updateDrawState(TextPaint ds) {
63 | ds.setStrikeThruText(true);
64 | }
65 |
66 | @Override
67 | public void readFromParcel(Parcel src){}
68 |
69 | @Override
70 | public void onAttachedToWindow(RichContentViewDisplay view) {
71 |
72 | }
73 |
74 | @Override
75 | public void onDetachedFromWindow(RichContentViewDisplay view) {
76 |
77 | }
78 |
79 | @Override
80 | public void onSpannedSetToView(RichContentView view){
81 |
82 | }
83 |
84 | @Override
85 | public void onViewAttachedToWindow(View v) {
86 |
87 | }
88 |
89 | @Override
90 | public void onViewDetachedFromWindow(View v) {
91 |
92 | }
93 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/Style.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.richtextlib.spans;
21 |
22 | import android.content.Context;
23 | import android.graphics.Bitmap;
24 |
25 |
26 |
27 |
28 | /**
29 | * Created by roberto on 17/06/15.
30 | */
31 | public interface Style {
32 |
33 |
34 | static final int NOT_SET = Integer.MIN_VALUE;
35 | static final int USE_DEFAULT = Integer.MIN_VALUE;
36 |
37 | Context getApplicationContext();
38 |
39 |
40 |
41 |
42 | /**
43 | * text color to be used for H1... headers
44 | */
45 | int headerColor();
46 |
47 | /**
48 | * The color to be used as the main background
49 | * @return
50 | */
51 | int backgroundColor();
52 |
53 | /**
54 | * the max width for images to be displayed
55 | * @return
56 | */
57 | int maxImageWidth();
58 |
59 | int maxImageHeight();
60 |
61 | /**
62 | * The multiplier for the text increase for Headers
63 | *
64 | * @param headerLevel from 1 to 6
65 | * @return 1.2 , 1.3 ecc ecc
66 | *
67 | */
68 | float headerIncrease(int headerLevel);
69 |
70 | /**
71 | * the text reduction to apply when the tag is encountered.
72 | * @return < 1
73 | */
74 | float smallTextReduce();
75 |
76 | /**
77 | * will make an attempt to resolve Wordpress tags such as [soundcloud /]
78 | */
79 | boolean parseWordPressTags();
80 |
81 | /**
82 | * when parsing pure HTML white spaces and new lines have to be considered differently
83 | * @return
84 | */
85 | boolean treatAsHtml();
86 |
87 | /**
88 | * @return true if the parser should extract images. False is images are treated inside the content
89 | */
90 | boolean extractImages();
91 |
92 | /**
93 | * @return true if the parser should extract videos. False is videos are treated inside the content
94 | */
95 | boolean extractVideos();
96 |
97 | /**
98 | * @return true if the parser should parse embeds or not
99 | */
100 | boolean extractEmbeds();
101 |
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/SubscriptSpan.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Copyright (c) 2015. Roberto Prato
4 | *
5 | * *
6 | * *
7 | * * Licensed under the Apache License, Version 2.0 (the "License");
8 | * * you may not use this file except in compliance with the License.
9 | * * You may obtain a copy of the License at
10 | * *
11 | * * http://www.apache.org/licenses/LICENSE-2.0
12 | * *
13 | * * Unless required by applicable law or agreed to in writing, software
14 | * * distributed under the License is distributed on an "AS IS" BASIS,
15 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * * See the License for the specific language governing permissions and
17 | * * limitations under the License.
18 | *
19 | */
20 |
21 | package io.square1.richtextlib.spans;
22 |
23 | import android.os.Parcel;
24 | import android.os.Parcelable;
25 | import android.text.TextPaint;
26 | import android.text.style.MetricAffectingSpan;
27 | import android.view.View;
28 |
29 | import io.square1.parcelable.DynamicParcelableCreator;
30 | import io.square1.richtextlib.ui.RichContentView;
31 | import io.square1.richtextlib.ui.RichContentViewDisplay;
32 | import io.square1.richtextlib.util.UniqueId;
33 |
34 | public class SubscriptSpan extends MetricAffectingSpan implements RichTextSpan {
35 |
36 | public static final Parcelable.Creator CREATOR = DynamicParcelableCreator.getInstance(SubscriptSpan.class);
37 |
38 | public static final int TYPE = UniqueId.getType();
39 |
40 | @Override
41 | public int getType() {
42 | return TYPE;
43 | }
44 |
45 | public SubscriptSpan() {
46 | }
47 |
48 | public SubscriptSpan(Parcel src) {
49 | }
50 |
51 |
52 | public int describeContents() {
53 | return 0;
54 | }
55 |
56 | public void writeToParcel(Parcel dest, int flags) {
57 | DynamicParcelableCreator.writeType(dest, this);
58 | }
59 |
60 |
61 | @Override
62 | public void updateDrawState(TextPaint tp) {
63 | tp.baselineShift -= (int) (tp.ascent() / 2);
64 | }
65 |
66 | @Override
67 | public void updateMeasureState(TextPaint tp) {
68 | tp.baselineShift -= (int) (tp.ascent() / 2);
69 | }
70 |
71 | @Override
72 | public void readFromParcel(Parcel src) {
73 |
74 | }
75 |
76 | @Override
77 | public void onAttachedToWindow(RichContentViewDisplay view) {
78 |
79 | }
80 |
81 | @Override
82 | public void onDetachedFromWindow(RichContentViewDisplay view) {
83 |
84 | }
85 |
86 | @Override
87 | public void onSpannedSetToView(RichContentView view){
88 |
89 | }
90 |
91 | @Override
92 | public void onViewAttachedToWindow(View v) {
93 |
94 | }
95 |
96 | @Override
97 | public void onViewDetachedFromWindow(View v) {
98 |
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/SuperscriptSpan.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Copyright (c) 2015. Roberto Prato
4 | *
5 | * *
6 | * *
7 | * * Licensed under the Apache License, Version 2.0 (the "License");
8 | * * you may not use this file except in compliance with the License.
9 | * * You may obtain a copy of the License at
10 | * *
11 | * * http://www.apache.org/licenses/LICENSE-2.0
12 | * *
13 | * * Unless required by applicable law or agreed to in writing, software
14 | * * distributed under the License is distributed on an "AS IS" BASIS,
15 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * * See the License for the specific language governing permissions and
17 | * * limitations under the License.
18 | *
19 | */
20 |
21 | package io.square1.richtextlib.spans;
22 |
23 | import android.os.Parcel;
24 | import android.os.Parcelable;
25 | import android.text.TextPaint;
26 | import android.text.style.MetricAffectingSpan;
27 | import android.view.View;
28 |
29 | import io.square1.parcelable.DynamicParcelableCreator;
30 | import io.square1.richtextlib.ui.RichContentView;
31 | import io.square1.richtextlib.ui.RichContentViewDisplay;
32 | import io.square1.richtextlib.util.UniqueId;
33 |
34 | public class SuperscriptSpan extends MetricAffectingSpan implements RichTextSpan {
35 |
36 | public static final Parcelable.Creator CREATOR = DynamicParcelableCreator.getInstance(SuperscriptSpan.class);
37 |
38 | public static final int TYPE = UniqueId.getType();
39 |
40 | @Override
41 | public int getType() {
42 | return TYPE;
43 | }
44 |
45 | public SuperscriptSpan() {
46 | }
47 |
48 | SuperscriptSpan(Parcel src) {
49 | }
50 |
51 |
52 |
53 | public int describeContents() {
54 | return 0;
55 | }
56 |
57 | public void writeToParcel(Parcel dest, int flags) {
58 | DynamicParcelableCreator.writeType(dest, this);
59 | }
60 |
61 | @Override
62 | public void updateDrawState(TextPaint tp) {
63 | tp.baselineShift += (int) (tp.ascent() / 2);
64 | }
65 |
66 | @Override
67 | public void updateMeasureState(TextPaint tp) {
68 | tp.baselineShift += (int) (tp.ascent() / 2);
69 | }
70 |
71 | @Override
72 | public void readFromParcel(Parcel src) {
73 |
74 | }
75 |
76 | @Override
77 | public void onAttachedToWindow(RichContentViewDisplay view) {
78 |
79 | }
80 |
81 | @Override
82 | public void onDetachedFromWindow(RichContentViewDisplay view) {
83 |
84 | }
85 |
86 | @Override
87 | public void onSpannedSetToView(RichContentView view){
88 |
89 | }
90 |
91 | @Override
92 | public void onViewAttachedToWindow(View v) {
93 |
94 | }
95 |
96 | @Override
97 | public void onViewDetachedFromWindow(View v) {
98 |
99 | }
100 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/UnderlineSpan.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.richtextlib.spans;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 | import android.text.TextPaint;
25 | import android.text.style.CharacterStyle;
26 | import android.text.style.UpdateAppearance;
27 | import android.view.View;
28 |
29 | import io.square1.parcelable.DynamicParcelableCreator;
30 | import io.square1.richtextlib.ui.RichContentView;
31 | import io.square1.richtextlib.ui.RichContentViewDisplay;
32 | import io.square1.richtextlib.util.UniqueId;
33 |
34 | public class UnderlineSpan extends CharacterStyle implements UpdateAppearance, RichTextSpan {
35 |
36 | public static final Parcelable.Creator CREATOR = DynamicParcelableCreator.getInstance(UnderlineSpan.class);
37 |
38 | public static final int TYPE = UniqueId.getType();
39 |
40 | @Override
41 | public int getType() {
42 | return TYPE;
43 | }
44 |
45 | public UnderlineSpan() {
46 | }
47 |
48 | public UnderlineSpan(Parcel src) {
49 | readFromParcel(src);
50 | }
51 |
52 |
53 | public int describeContents() {
54 | return 0;
55 | }
56 |
57 | public void writeToParcel(Parcel dest, int flags) {
58 | DynamicParcelableCreator.writeType(dest, this);
59 | }
60 |
61 | @Override
62 | public void updateDrawState(TextPaint ds) {
63 | ds.setUnderlineText(true);
64 | }
65 |
66 | @Override
67 | public void readFromParcel(Parcel src) {
68 |
69 | }
70 |
71 | @Override
72 | public void onAttachedToWindow(RichContentViewDisplay view) {
73 |
74 | }
75 |
76 | @Override
77 | public void onDetachedFromWindow(RichContentViewDisplay view) {
78 |
79 | }
80 |
81 | @Override
82 | public void onSpannedSetToView(RichContentView view){
83 |
84 | }
85 |
86 | @Override
87 | public void onViewAttachedToWindow(View v) {
88 |
89 | }
90 |
91 | @Override
92 | public void onViewDetachedFromWindow(View v) {
93 |
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/spans/UrlBitmapDownloader.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.richtextlib.spans;
21 |
22 | import android.net.Uri;
23 |
24 | /**
25 | * Created by roberto on 30/06/15.
26 | */
27 | public interface UrlBitmapDownloader {
28 | void downloadImage(RemoteBitmapSpan urlBitmapSpan, Uri image);
29 | }
30 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/ui/RichContentViewDisplay.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.richtextlib.ui;
21 |
22 | import android.content.Context;
23 |
24 | import android.graphics.Point;
25 | import android.graphics.drawable.Drawable;
26 | import android.view.View;
27 |
28 |
29 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
30 | import io.square1.richtextlib.spans.ClickableSpan;
31 | import io.square1.richtextlib.spans.UrlBitmapDownloader;
32 |
33 | /**
34 | * Created by roberto on 24/06/15.
35 | */
36 | public interface RichContentViewDisplay extends Drawable.Callback {
37 |
38 |
39 | Point getSpanOrigin(Object span);
40 | void addSubView(View view);
41 | void setText(RichTextDocumentElement content);
42 | void setUrlBitmapDownloader(UrlBitmapDownloader downloader);
43 | void setRichTextContentChanged(RichTextContentChanged richTextContentChanged);
44 |
45 |
46 |
47 | public interface OnSpanClickedObserver {
48 | boolean onSpanClicked(ClickableSpan span);
49 | }
50 |
51 | public interface RichTextContentChanged {
52 | void onContentChanged(RichContentViewDisplay view);
53 | }
54 |
55 |
56 | UrlBitmapDownloader getDownloader();
57 |
58 | void invalidate();
59 | void requestLayout();
60 | boolean viewAttachedToWindow();
61 | int getMeasuredWidth();
62 | void performLayout();
63 | Context getContext();
64 |
65 | void mediaSizeUpdated();
66 |
67 | public int getPaddingLeft();
68 | public int getPaddingRight();
69 |
70 | Appearance getStyle();
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/ui/audio/Media.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.richtextlib.ui.audio;
21 |
22 | /**
23 | * Created by roberto on 17/09/15.
24 | */
25 | public class Media {
26 |
27 | public static final int DURATION_UNKNOWN = -1;
28 |
29 | public String file;
30 | public long duration = DURATION_UNKNOWN;
31 |
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/ui/video/InternalMediaPlayer.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.richtextlib.ui.video;
21 |
22 | import android.media.MediaPlayer;
23 |
24 | class InternalMediaPlayer extends MediaPlayer {
25 |
26 |
27 | private OnCompletionListener mOnCompletionListener;
28 | private OnSeekCompleteListener mSeekListener;
29 |
30 | public OnCompletionListener getOnCompletionListener() {
31 | return mOnCompletionListener;
32 | }
33 |
34 | @Override
35 | public void setOnCompletionListener(OnCompletionListener completionListener) {
36 | mOnCompletionListener = completionListener;
37 | super.setOnCompletionListener(completionListener);
38 | }
39 |
40 |
41 | @Override
42 | public void setOnSeekCompleteListener(OnSeekCompleteListener listener){
43 | mSeekListener = listener;
44 | super.setOnSeekCompleteListener(mSeekListener);
45 | }
46 |
47 | public OnSeekCompleteListener getSeekListener(){
48 | return mSeekListener;
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/ui/video/MediaPlayerPool.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.richtextlib.ui.video;
21 |
22 | import android.content.Context;
23 |
24 | import java.util.HashMap;
25 | import java.util.StringTokenizer;
26 |
27 | /**
28 | * Created by roberto on 19/10/2016.
29 | *
30 | *
31 | * Keeps a pool of MedialPlayers
32 | *
33 | */
34 |
35 | public class MediaPlayerPool {
36 |
37 | HashMap mMediaPlayerHashMap;
38 |
39 |
40 | public MediaPlayerPool(){
41 | mMediaPlayerHashMap = new HashMap<>();
42 | }
43 |
44 | public RichMediaPlayer get(Context context, String videoPath){
45 |
46 | synchronized (this){
47 |
48 | RichMediaPlayer mediaPlayer = mMediaPlayerHashMap.get(videoPath);
49 | if(mediaPlayer == null){
50 | mediaPlayer = new RichMediaPlayer(context);
51 | mMediaPlayerHashMap.put(videoPath, mediaPlayer);
52 | mediaPlayer.setData(videoPath);
53 | }
54 |
55 | return mediaPlayer;
56 | }
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/ui/web/VideoEnabledWebChromeClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.ui.web;
21 |
22 | import android.media.MediaPlayer;
23 | import android.webkit.WebChromeClient;
24 |
25 | /**
26 | * Created by roberto on 23/06/2017.
27 | */
28 |
29 | public class VideoEnabledWebChromeClient extends WebChromeClient implements
30 | MediaPlayer.OnPreparedListener,
31 | MediaPlayer.OnCompletionListener,
32 | MediaPlayer.OnErrorListener {
33 |
34 |
35 | @Override
36 | public void onCompletion(MediaPlayer mp) {
37 |
38 | }
39 |
40 | @Override
41 | public boolean onError(MediaPlayer mp, int what, int extra) {
42 | return false;
43 | }
44 |
45 | @Override
46 | public void onPrepared(MediaPlayer mp) {
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/util/CatchAndLog.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.richtextlib.util;
21 |
22 | /**
23 | * Created by roberto on 19/06/15.
24 | */
25 | public class CatchAndLog {
26 |
27 |
28 | public final static void catchAndLog(Runnable run){
29 |
30 | try{
31 | run.run();
32 | }catch (Exception exc){}
33 |
34 |
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/util/NumberUtils.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.richtextlib.util;
21 |
22 | import android.text.TextUtils;
23 |
24 | import java.util.Arrays;
25 |
26 | /**
27 | * Created by roberto on 30/06/15.
28 | */
29 | public class NumberUtils {
30 |
31 | public static final int INVALID = -1;
32 |
33 | public static int parseAttributeDimension(String in, int maxSize){
34 | try {
35 | if( in.indexOf(in.length() - 1 , '%') >= 0){
36 | //percentage
37 | float perc = Float.parseFloat(in.substring(0,in.length() - 2));
38 | return (int) ((float)maxSize / 100.0f * perc);
39 |
40 | }
41 | return Integer.parseInt(in);
42 | }catch (Exception e){
43 | return INVALID;
44 | }
45 | }
46 |
47 | public static int parseInt(String input){
48 |
49 | if(TextUtils.isEmpty(input) == true){
50 | return -1;
51 | }
52 | try{
53 | return Integer.parseInt(input);
54 | }catch (Exception e){}
55 |
56 | return -1;
57 | }
58 |
59 | public static int max(int... values){
60 | if(values == null || values.length == 0){
61 | return -1;
62 | }
63 | Arrays.sort(values);
64 | return values[values.length - 1];
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/util/Size.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.util;
21 |
22 | import android.graphics.Rect;
23 | import android.os.Parcel;
24 | import android.os.Parcelable;
25 |
26 | /**
27 | * Created by roberto on 01/08/2017.
28 | */
29 |
30 | public class Size implements Parcelable {
31 |
32 | @Override
33 | public String toString() {
34 | return "Size{" +
35 | "mWidth=" + mWidth +
36 | ", mHeight=" + mHeight +
37 | '}';
38 | }
39 |
40 | private final int mWidth;
41 | private final int mHeight;
42 |
43 | public Size(int width, int height) {
44 | mWidth = width;
45 | mHeight = height;
46 | }
47 |
48 | public static boolean valid(Size size){
49 |
50 | if(size == null) return false;
51 | if(size.mWidth == NumberUtils.INVALID) return false;
52 | if(size.mHeight == NumberUtils.INVALID) return false;
53 |
54 | return true;
55 |
56 | }
57 |
58 | public Rect bounds(int x, int y){
59 | return new Rect(x,y, mWidth, mHeight);
60 | }
61 |
62 | public Rect bounds(){
63 | return bounds(0,0);
64 | }
65 |
66 | public final int getHeight(){
67 | return mHeight;
68 | }
69 |
70 | public final int getWidth(){
71 | return mWidth;
72 | }
73 |
74 | public final double getRatio(){
75 | return (double)mHeight / (double)mWidth;
76 | }
77 |
78 | @Override
79 | public int describeContents() {
80 | return 0;
81 | }
82 |
83 | @Override
84 | public void writeToParcel(Parcel dest, int flags) {
85 | dest.writeInt(this.mWidth);
86 | dest.writeInt(this.mHeight);
87 | }
88 |
89 | protected Size(Parcel in) {
90 | this.mWidth = in.readInt();
91 | this.mHeight = in.readInt();
92 | }
93 |
94 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
95 | @Override
96 | public Size createFromParcel(Parcel source) {
97 | return new Size(source);
98 | }
99 |
100 | @Override
101 | public Size[] newArray(int size) {
102 | return new Size[size];
103 | }
104 | };
105 | }
106 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/util/UniqueId.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.richtextlib.util;
21 |
22 | /**
23 | * Created by roberto on 25/06/15.
24 | */
25 | public class UniqueId {
26 |
27 | private static int sSeed = 100;
28 |
29 | synchronized public static final int getType(){
30 | return sSeed ++;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/util/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.richtextlib.util;
21 |
22 | import android.os.Looper;
23 | import android.util.Log;
24 |
25 | /**
26 | * Created by roberto on 04/10/15.
27 | */
28 | public class Utils {
29 |
30 | public static T newInstance(String className){
31 |
32 | try {
33 | Class currentClass = (Class) Class.forName(className);
34 | return newInstance(currentClass);
35 | }catch (Exception e){
36 | Log.e("CLASS" , className);
37 | e.printStackTrace();
38 | }
39 |
40 | return null;
41 | }
42 |
43 | public static T newInstance(Class currentClass){
44 |
45 | try {
46 | T item = currentClass.newInstance();
47 | Log.i("CLASS", currentClass.getName());
48 | return item;
49 | }catch (Exception e){
50 | Log.e("CLASS" , currentClass.getName());
51 | e.printStackTrace();
52 | }
53 |
54 | return null;
55 | }
56 |
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/content/DocumentElement.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.richtextlib.v2.content;
21 |
22 | import android.os.Parcel;
23 | import android.os.Parcelable;
24 | import android.util.Log;
25 |
26 | import io.square1.parcelable.DynamicParcelable;
27 | import io.square1.parcelable.DynamicParcelableCreator;
28 | import io.square1.richtextlib.util.Utils;
29 |
30 | /**
31 | * Created by roberto on 08/09/15.
32 | */
33 | public abstract class DocumentElement implements Parcelable /**implements DynamicParcelable**/ {
34 |
35 |
36 | public DocumentElement(){}
37 |
38 |
39 | protected abstract void write(Parcel dest, int flags);
40 | public abstract void readFromParcel(Parcel source);
41 |
42 |
43 | @Override
44 | public int describeContents() {
45 | return 0;
46 | }
47 |
48 | @Override
49 | final public void writeToParcel(Parcel dest, int flags) {
50 | dest.writeString(this.getClass().getName());
51 | write(dest, flags);
52 | }
53 |
54 | private DocumentElement(Parcel in) {
55 | }
56 |
57 | public static final Creator CREATOR = new Creator() {
58 | @Override
59 | public DocumentElement createFromParcel(Parcel source) {
60 |
61 | String className = source.readString();
62 | DocumentElement item = Utils.newInstance(className);
63 | if(item != null){
64 | item.readFromParcel(source);
65 | }
66 | return item;
67 |
68 | }
69 |
70 | @Override
71 | public DocumentElement[] newArray(int size) {
72 | return new DocumentElement[size];
73 | }
74 | };
75 | }
76 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/content/VideoDocumentElement.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.richtextlib.v2.content;
21 |
22 | import android.os.Parcel;
23 |
24 | import io.square1.richtextlib.EmbedUtils;
25 |
26 | /**
27 | * Created by roberto on 10/09/15.
28 | */
29 | public class VideoDocumentElement extends DocumentElement {
30 |
31 |
32 | private String mVideoUrl;
33 | private int mWidth = -1;
34 | private int mHeight = -1;
35 |
36 |
37 | public static VideoDocumentElement newInstance(String videoUrl , int width, int height){
38 | return new VideoDocumentElement(videoUrl, width, height);
39 | }
40 |
41 | public VideoDocumentElement(){
42 | super();
43 | }
44 |
45 | @Override
46 | protected void write(Parcel dest, int flags) {
47 | dest.writeString(mVideoUrl);
48 | }
49 |
50 | @Override
51 | public void readFromParcel(Parcel source) {
52 | mVideoUrl = source.readString();
53 | }
54 |
55 | public VideoDocumentElement(String video, int width, int height){
56 | super();
57 | mVideoUrl = video;
58 | mWidth = width;
59 | mHeight = height;
60 |
61 | }
62 |
63 | public String getContent() {
64 | return mVideoUrl;
65 | }
66 |
67 | public int getWidth(){
68 | return mWidth;
69 | }
70 |
71 | public int getHeight(){
72 | return mHeight;
73 | }
74 |
75 |
76 | public static final Creator CREATOR = DocumentElement.CREATOR;
77 | }
78 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/content/WebDocumentElement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.v2.content;
21 |
22 | import android.os.Parcel;
23 |
24 | /**
25 | * Created by roberto on 10/09/15.
26 | */
27 | public class WebDocumentElement extends DocumentElement {
28 |
29 | public enum ContentType {
30 | EUrl,
31 | EHtml
32 | }
33 |
34 |
35 | private String mContent;
36 | private ContentType mType;
37 |
38 | private int mWidth = -1;
39 | private int mHeight = -1;
40 |
41 | public WebDocumentElement(){
42 | super();
43 | }
44 |
45 | public WebDocumentElement(String content,
46 | ContentType type,
47 | int width,
48 | int height){
49 | super();
50 | mType = type;
51 | mWidth = width;
52 | mHeight = height;
53 | mContent = content;
54 |
55 |
56 |
57 | }
58 |
59 | public ContentType getType(){
60 | return mType;
61 | }
62 | public String getContent(){
63 | return mContent;
64 | }
65 |
66 |
67 | @Override
68 | public void readFromParcel(Parcel source) {
69 | mContent = source.readString();
70 | int tmpMType = source.readInt();
71 | this.mType = tmpMType == -1 ? null : ContentType.values()[tmpMType];
72 | mWidth = source.readInt();
73 | mHeight = source.readInt();
74 | }
75 |
76 | public int getWidth(){
77 | return mWidth;
78 | }
79 |
80 | public int getHeight(){
81 | return mHeight;
82 | }
83 |
84 | @Override
85 | public int describeContents() {
86 | return 0;
87 | }
88 |
89 | @Override
90 | public void write(Parcel dest, int flags) {
91 | dest.writeString(this.mContent);
92 | dest.writeInt(this.mType == null ? -1 : this.mType.ordinal());
93 | dest.writeInt(this.mWidth);
94 | dest.writeInt(this.mHeight);
95 | }
96 |
97 |
98 |
99 |
100 | public static final Creator CREATOR = DocumentElement.CREATOR;
101 |
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/facebook/FacebookContext.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.richtextlib.v2.parser.advanced.facebook;
21 |
22 | import io.square1.richtextlib.spans.Style;
23 | import io.square1.richtextlib.v2.RichTextV2;
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.v2.parser.MarkupContext;
26 | import io.square1.richtextlib.v2.parser.MarkupTag;
27 | import io.square1.richtextlib.v2.parser.TagHandler;
28 | import io.square1.richtextlib.v2.parser.handlers.AppendContentHandler;
29 | import io.square1.richtextlib.v2.parser.handlers.IgnoreContentHandler;
30 |
31 | /**
32 | * Created by roberto on 17/12/2015.
33 | */
34 | public class FacebookContext extends MarkupContext {
35 |
36 | public enum FBPostType {
37 | EUnknown,
38 | EPost,
39 | EVideo
40 | }
41 |
42 |
43 | private String mFacebookPostUrl;
44 | private FBPostType mType;
45 |
46 | public FacebookContext(RichTextV2 richText, Style style) {
47 | super();
48 | mType = FBPostType.EUnknown;
49 | setRichText(richText);
50 | setStyle(style);
51 | }
52 |
53 | public void setType(FBPostType type){
54 | mType = type;
55 | }
56 |
57 | public FBPostType getType(){
58 | return mType;
59 | }
60 |
61 |
62 | public void setFacebookPostUrl(String postUrl){
63 | mFacebookPostUrl = postUrl;
64 | }
65 |
66 | public String getFacebookPostUrl(){
67 | return mFacebookPostUrl;
68 | }
69 |
70 | // public RichTextDocumentElement replaceBuilder(RichTextDocumentElement in){
71 | // if(mInternalContent == null){
72 | // mInternalContent = new RichTextDocumentElement();
73 | // }
74 | // return mInternalContent;
75 | // }
76 |
77 |
78 | @Override
79 | public TagHandler getTagHandler(MarkupTag tag) {
80 |
81 | TagHandler handler = tag.getTagHandler();
82 |
83 | if(handler == null) {
84 | if("a".equalsIgnoreCase(tag.tag) == false) {
85 | handler = new AppendContentHandler();
86 | handler.replaceContext(this);
87 | tag.setTagHandler(handler);
88 | }else {
89 | return super.getTagHandler(tag);
90 | }
91 | }
92 |
93 | return handler;
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/instagram/InstagramContext.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.richtextlib.v2.parser.advanced.instagram;
21 |
22 | import io.square1.richtextlib.spans.Style;
23 | import io.square1.richtextlib.v2.RichTextV2;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.parser.handlers.IgnoreContentHandler;
28 |
29 | class InstagramContext extends MarkupContext {
30 |
31 | private String mInstagramId;
32 |
33 | public void setInstagramId(String instagramId){
34 | mInstagramId = instagramId;
35 | }
36 |
37 | public InstagramContext(RichTextV2 richText, Style style) {
38 | super();
39 | setRichText(richText);
40 | setStyle(style);
41 | }
42 |
43 | public String getInstagramId(){
44 | return mInstagramId;
45 | }
46 |
47 | @Override
48 | public TagHandler getTagHandler(MarkupTag tag) {
49 |
50 | TagHandler handler = tag.getTagHandler();
51 |
52 | if(handler == null) {
53 |
54 | if ("a".equalsIgnoreCase(tag.tag) == true) {
55 | handler = new InstagramLinkTagHandler();
56 | } else {
57 | handler = new IgnoreContentHandler();
58 | }
59 |
60 | handler.replaceContext(this);
61 | tag.setTagHandler(handler);
62 | }
63 |
64 | return handler;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/instagram/InstagramLinkTagHandler.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.richtextlib.v2.parser.advanced.instagram;
21 |
22 | import android.text.TextUtils;
23 |
24 | import io.square1.richtextlib.EmbedUtils;
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 |
30 | class InstagramLinkTagHandler extends TagHandler {
31 |
32 | @Override
33 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
34 | String href = tag.attributes.getValue("", "href");
35 | String instagramId = EmbedUtils.getInstagramId(href);
36 | if (TextUtils.isEmpty(instagramId) == false) {
37 | ((InstagramContext) context).setInstagramId(instagramId);
38 | //context.getRichText().onEmbedFound(EmbedUtils.TEmbedType.ETwitter,tweetId);
39 | }
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 |
45 |
46 | }
47 |
48 | public boolean processContent() {
49 | return false;
50 | }
51 |
52 | @Override
53 | public boolean closeWhenSplitting() {
54 | return false;
55 | }
56 |
57 | @Override
58 | public boolean openWhenSplitting() {
59 | return false;
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/instagram/InstagramQuoteTagHandler.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.richtextlib.v2.parser.advanced.instagram;
21 |
22 | import android.text.TextUtils;
23 |
24 | import io.square1.richtextlib.EmbedUtils;
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 |
30 |
31 | public class InstagramQuoteTagHandler extends TagHandler {
32 |
33 |
34 | private InstagramContext mInstagramContext;
35 |
36 | @Override
37 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 |
39 | if(TextUtils.isEmpty(mInstagramContext.getInstagramId()) == false){
40 |
41 | context.getRichText().onEmbedFound(EmbedUtils.TEmbedType.EInstagram,
42 | mInstagramContext.getInstagramId());
43 |
44 | }
45 | }
46 |
47 |
48 | @Override
49 | public MarkupContext getReplacementContext(){
50 |
51 | if(mInstagramContext == null){
52 |
53 | mInstagramContext = new InstagramContext(getInitialContext().getRichText(),
54 | getInitialContext().getStyle());
55 | }
56 | return mInstagramContext;
57 | }
58 |
59 | public MarkupContext getInitialContext(){
60 | return super.getInitialContext();
61 | }
62 |
63 | @Override
64 | public boolean closeWhenSplitting() {
65 | return false;
66 | }
67 |
68 | @Override
69 | public boolean openWhenSplitting() {
70 | return false;
71 | }
72 |
73 | @Override
74 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
75 |
76 | }
77 |
78 | @Override
79 | public boolean processContent() {
80 | return false;
81 | }
82 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/twitter/TwitterContext.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.richtextlib.v2.parser.advanced.twitter;
21 |
22 | import io.square1.richtextlib.spans.Style;
23 | import io.square1.richtextlib.v2.RichTextV2;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.parser.handlers.IgnoreContentHandler;
28 |
29 | class TwitterContext extends MarkupContext {
30 |
31 | private String mTweetId;
32 |
33 | public void setTweetId(String tweetId){
34 | mTweetId = tweetId;
35 | }
36 |
37 | public TwitterContext(RichTextV2 richText, Style style) {
38 | super();
39 | setRichText(richText);
40 | setStyle(style);
41 | }
42 |
43 | public String getTweetId(){
44 | return mTweetId;
45 | }
46 |
47 | @Override
48 | public TagHandler getTagHandler(MarkupTag tag) {
49 |
50 | TagHandler handler = tag.getTagHandler();
51 |
52 | if(handler == null) {
53 |
54 | if ("a".equalsIgnoreCase(tag.tag) == true) {
55 | handler = new TwitterLinkTagHandler();
56 | } else {
57 | handler = new IgnoreContentHandler();
58 | }
59 |
60 | handler.replaceContext(this);
61 | tag.setTagHandler(handler);
62 | }
63 |
64 | return handler;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/twitter/TwitterLinkTagHandler.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.richtextlib.v2.parser.advanced.twitter;
21 |
22 | import android.text.TextUtils;
23 |
24 | import io.square1.richtextlib.EmbedUtils;
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 |
30 | class TwitterLinkTagHandler extends TagHandler {
31 |
32 | @Override
33 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
34 | String href = tag.attributes.getValue("", "href");
35 | String tweetId = EmbedUtils.getTweetId(href);
36 | if (TextUtils.isEmpty(tweetId) == false) {
37 | ((TwitterContext) context).setTweetId(tweetId);
38 | //context.getRichText().onEmbedFound(EmbedUtils.TEmbedType.ETwitter,tweetId);
39 | }
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 |
45 |
46 | }
47 |
48 | @Override
49 | public boolean closeWhenSplitting() {
50 | return false;
51 | }
52 |
53 | @Override
54 | public boolean openWhenSplitting() {
55 | return false;
56 | }
57 |
58 | public boolean processContent() {
59 | return false;
60 | }
61 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/advanced/twitter/TwitterQuoteTagHandler.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.richtextlib.v2.parser.advanced.twitter;
21 |
22 | import android.text.TextUtils;
23 |
24 | import io.square1.richtextlib.EmbedUtils;
25 |
26 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
27 | import io.square1.richtextlib.v2.parser.MarkupContext;
28 | import io.square1.richtextlib.v2.parser.MarkupTag;
29 | import io.square1.richtextlib.v2.parser.TagHandler;
30 |
31 |
32 | public class TwitterQuoteTagHandler extends TagHandler {
33 |
34 |
35 | private TwitterContext mTwitterContext;
36 |
37 | @Override
38 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
39 |
40 | if(TextUtils.isEmpty(mTwitterContext.getTweetId()) == false){
41 |
42 | context.getRichText().onEmbedFound(EmbedUtils.TEmbedType.ETwitter,
43 | mTwitterContext.getTweetId());
44 |
45 | }
46 | }
47 |
48 | @Override
49 | public MarkupContext getReplacementContext(){
50 |
51 | if(mTwitterContext == null){
52 |
53 | mTwitterContext = new TwitterContext(getInitialContext().getRichText(),
54 | getInitialContext().getStyle());
55 | }
56 | return mTwitterContext;
57 | }
58 |
59 | public MarkupContext getInitialContext(){
60 | return super.getInitialContext();
61 | }
62 |
63 | @Override
64 | public boolean closeWhenSplitting() {
65 | return false;
66 | }
67 |
68 | @Override
69 | public boolean openWhenSplitting() {
70 | return false;
71 | }
72 |
73 | @Override
74 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
75 |
76 | }
77 |
78 | @Override
79 | public boolean processContent() {
80 | return false;
81 | }
82 | }
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/AHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.text.Spannable;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.URLSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 |
30 | /**
31 | * Created by roberto on 04/09/15.
32 | */
33 | public class AHandler extends TagHandler {
34 |
35 | @Override
36 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
37 | String href = tag.attributes.getValue("", "href");
38 | int len = out.length();
39 | Markers.Href h = new Markers.Href(href);
40 | out.setSpan(h, len, len, Spannable.SPAN_MARK_MARK);
41 | }
42 |
43 | @Override
44 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
45 |
46 | int len = out.length();
47 | Object obj = out.getLastSpan(Markers.Href.class);
48 | int where = out.getSpanStart(obj);
49 | out.removeSpan(obj);
50 |
51 | if (where != len) {
52 |
53 | if(obj == null){
54 | return;
55 | }
56 |
57 | Markers.Href h = (Markers.Href) obj;
58 |
59 | if (h.mHref != null) {
60 | //TODO if in noscript tag we should update the context and supply a different class for href
61 | // if(isWithinTag( stack, "noscript") != null){
62 | // out.setSpan(new UnsupportedContentSpan(h.mHref), where, len,
63 | // Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
64 | // }else {
65 | out.setSpan(new URLSpan(h.mHref), where, len,
66 | Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
67 | // }
68 | }
69 | }
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/AUDIOHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 | import android.text.TextUtils;
24 |
25 | import org.xml.sax.Attributes;
26 |
27 | import io.square1.richtextlib.EmbedUtils;
28 | import io.square1.richtextlib.spans.StyleSpan;
29 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
30 | import io.square1.richtextlib.v2.parser.MarkupContext;
31 | import io.square1.richtextlib.v2.parser.MarkupTag;
32 | import io.square1.richtextlib.v2.parser.TagHandler;
33 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
34 |
35 | /**
36 | * Created by roberto on 13/09/2017.
37 | */
38 |
39 | public class AUDIOHandler extends TagHandler {
40 |
41 | @Override
42 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
43 |
44 | Markers.Audio audioMarker = new Markers.Audio();
45 | Attributes attributes = tag.attributes;
46 | audioMarker.src = attributes.getValue("", "src");
47 | audioMarker.type = attributes.getValue("", "type");
48 |
49 | SpannedBuilderUtils.startSpan(out, audioMarker);
50 | }
51 |
52 | @Override
53 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
54 |
55 | Markers.MarkerWithSource source = out.getLastSpan(Markers.MarkerWithSource.class);
56 | if(source != null &&
57 | TextUtils.isEmpty(source.src) == false){
58 |
59 | SpannedBuilderUtils.trimTrailNewlines(out, 0);
60 |
61 | if(context.getStyle().extractEmbeds() == true) {
62 | context.getRichText().onEmbedFound(EmbedUtils.TEmbedType.EAudio, source.src);
63 | }else {
64 | SpannedBuilderUtils.makeUnsupported(source.src, source.src, out);
65 | }
66 | }
67 | }
68 |
69 | public boolean processContent() {
70 | return false;
71 | }
72 |
73 |
74 | @Override
75 | public boolean closeWhenSplitting(){
76 | return false;
77 | }
78 |
79 |
80 | @Override
81 | public boolean openWhenSplitting(){
82 | return false;
83 | }
84 |
85 | public boolean childAllowed(MarkupTag childTag){
86 | return "source".equalsIgnoreCase(childTag.tag);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/AppendContentHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 |
27 | /**
28 | * Created by roberto on 13/12/2015.
29 | */
30 | public class AppendContentHandler extends TagHandler {
31 |
32 | @Override
33 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
34 |
35 | }
36 |
37 | @Override
38 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
39 |
40 | }
41 |
42 | public boolean processContent() {
43 | return true;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/BHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.StyleSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
30 |
31 | /**
32 | * Created by roberto on 04/09/15.
33 | */
34 | public class BHandler extends TagHandler {
35 |
36 | @Override
37 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 | SpannedBuilderUtils.startSpan(out, new Markers.Bold());
39 |
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 | SpannedBuilderUtils.endSpan(out, Markers.Bold.class, new StyleSpan(Typeface.BOLD));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/BIGHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.spans.RelativeSizeSpan;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class BIGHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.startSpan(out, new Markers.Big());
37 | }
38 |
39 | @Override
40 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | SpannedBuilderUtils.endSpan(out, Markers.Big.class, new RelativeSizeSpan(1.25f));
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/BLOCKQUOTEHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 | import android.text.Spannable;
24 |
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.spans.QuoteSpan;
27 | import io.square1.richtextlib.spans.Style;
28 | import io.square1.richtextlib.spans.StyleSpan;
29 | import io.square1.richtextlib.v2.parser.MarkupContext;
30 | import io.square1.richtextlib.v2.parser.MarkupTag;
31 | import io.square1.richtextlib.v2.parser.TagHandler;
32 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
33 |
34 | /**
35 | * Created by roberto on 04/09/15.
36 | */
37 | public class BLOCKQUOTEHandler extends TagHandler {
38 |
39 | @Override
40 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 |
42 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out, 2);
43 | SpannedBuilderUtils.startSpan(out, new Markers.Blockquote(tag.elementClasses));
44 | // handleP(spannable);
45 | }
46 |
47 | @Override
48 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
49 |
50 | //TODO handle Tweets
51 | Markers.Blockquote obj = out.getLastSpan(Markers.Blockquote.class);
52 | if(obj == null) return;
53 |
54 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out, 2);
55 |
56 | int len = out.length();
57 | int where = out.getSpanStart(obj);
58 | out.removeSpan(obj);
59 |
60 | if (where != len) {
61 | StyleSpan styleSpan = new StyleSpan(Typeface.ITALIC);
62 | out.setSpan(styleSpan, where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
63 | QuoteSpan quoteSpan = new QuoteSpan();
64 | out.setSpan(quoteSpan, where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/BRHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
27 |
28 | /**
29 | * Created by roberto on 04/09/15.
30 | */
31 | public class BRHandler extends TagHandler {
32 |
33 | @Override
34 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
35 |
36 | }
37 |
38 | @Override
39 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
40 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/BaseListHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
27 |
28 | /**
29 | * Created by roberto on 04/09/15.
30 | */
31 | public abstract class BaseListHandler extends TagHandler {
32 |
33 | private static int sNestedListsCount = 0;
34 |
35 | public static int getNestedListsCount(){
36 | return sNestedListsCount;
37 | }
38 |
39 | @Override
40 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out, 1);
42 | sNestedListsCount ++;
43 | }
44 |
45 | @Override
46 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
47 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
48 | sNestedListsCount --;
49 |
50 | }
51 |
52 |
53 | @Override
54 | public boolean closeWhenSplitting(){
55 | return false;
56 | }
57 |
58 |
59 | @Override
60 | public boolean openWhenSplitting(){
61 | return false;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/CITEHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.StyleSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
30 |
31 | /**
32 | * Created by roberto on 04/09/15.
33 | */
34 | public class CITEHandler extends TagHandler {
35 |
36 | @Override
37 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 | SpannedBuilderUtils.startSpan(out, new Markers.Italic());
39 |
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 | SpannedBuilderUtils.endSpan(out, Markers.Italic.class, new StyleSpan(Typeface.ITALIC));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/CODEHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 | import android.text.Spannable;
24 |
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.spans.LeadingMarginSpan;
27 | import io.square1.richtextlib.spans.Style;
28 | import io.square1.richtextlib.spans.StyleSpan;
29 | import io.square1.richtextlib.v2.parser.MarkupContext;
30 | import io.square1.richtextlib.v2.parser.MarkupTag;
31 | import io.square1.richtextlib.v2.parser.TagHandler;
32 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
33 |
34 | /**
35 | * Created by roberto on 04/09/15.
36 | */
37 | public class CODEHandler extends TagHandler {
38 |
39 | @Override
40 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 |
42 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out, 2);
43 | SpannedBuilderUtils.startSpan(out, new Markers.Code());
44 | // handleP(spannable);
45 | }
46 |
47 | @Override
48 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
49 |
50 | //TODO handle Tweets
51 | Markers.Code obj = out.getLastSpan(Markers.Code.class);
52 | if(obj == null) return;
53 |
54 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out, 2);
55 |
56 | int len = out.length();
57 | int where = out.getSpanStart(obj);
58 | out.removeSpan(obj);
59 |
60 | if (where != len) {
61 | StyleSpan styleSpan = new StyleSpan(Typeface.ITALIC);
62 | out.setSpan(styleSpan, where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
63 | LeadingMarginSpan quoteSpan = new LeadingMarginSpan(10,10);
64 | out.setSpan(quoteSpan, where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/DDHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.spans.LeadingMarginSpan;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 19/08/15.
31 | */
32 | public class DDHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
37 | SpannedBuilderUtils.startSpan(out, new Markers.LeadingMargin());
38 | }
39 |
40 | @Override
41 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
42 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
43 | SpannedBuilderUtils.endSpan(out, Markers.LeadingMargin.class, new LeadingMarginSpan(10,10));
44 | }
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/DELHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.spans.StrikethroughSpan;
23 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class DELHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.startSpan(out, new Markers.Strike());
37 | }
38 |
39 | @Override
40 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | SpannedBuilderUtils.endSpan(out, Markers.Strike.class, new StrikethroughSpan());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/DFNHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.StyleSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
30 |
31 | /**
32 | * Created by roberto on 04/09/15.
33 | */
34 | public class DFNHandler extends TagHandler {
35 |
36 | @Override
37 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 | SpannedBuilderUtils.startSpan(out, new Markers.Italic());
39 |
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 | SpannedBuilderUtils.endSpan(out, Markers.Italic.class, new StyleSpan(Typeface.ITALIC));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/DLHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class DLHandler extends BaseListHandler {
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/DTHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
27 |
28 | /**
29 | * Created by roberto on 19/08/15.
30 | */
31 | public class DTHandler extends TagHandler {
32 |
33 | @Override
34 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
35 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out, 2);
36 | }
37 |
38 | @Override
39 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
40 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/DefaultHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.util.Log;
23 |
24 | import io.square1.richtextlib.v2.RichTextV2;
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 |
30 | /**
31 | * Created by roberto on 19/08/15.
32 | */
33 | public final class DefaultHandler extends TagHandler {
34 |
35 | @Override
36 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
37 | Log.i(RichTextV2.TAG, tag.tag + " not supported" );
38 | }
39 |
40 | @Override
41 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/EMHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.StyleSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
30 |
31 | /**
32 | * Created by roberto on 04/09/15.
33 | */
34 | public class EMHandler extends TagHandler {
35 |
36 | @Override
37 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 | SpannedBuilderUtils.startSpan(out, new Markers.Italic());
39 |
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 | SpannedBuilderUtils.endSpan(out, Markers.Italic.class, new StyleSpan(Typeface.ITALIC));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/H1Handler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class H1Handler extends HeaderBaseHandler {}
26 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/H2Handler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class H2Handler extends HeaderBaseHandler {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/H3Handler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class H3Handler extends HeaderBaseHandler {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/H4Handler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class H4Handler extends HeaderBaseHandler {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/H5Handler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class H5Handler extends HeaderBaseHandler {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/H6Handler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class H6Handler extends HeaderBaseHandler {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/IHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.StyleSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
30 |
31 | /**
32 | * Created by roberto on 04/09/15.
33 | */
34 | public class IHandler extends TagHandler {
35 |
36 | @Override
37 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 | SpannedBuilderUtils.startSpan(out, new Markers.Italic());
39 |
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 | SpannedBuilderUtils.endSpan(out, Markers.Italic.class, new StyleSpan(Typeface.ITALIC));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/IgnoreContentHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 |
27 | /**
28 | * Created by roberto on 13/12/2015.
29 | */
30 | public class IgnoreContentHandler extends TagHandler {
31 |
32 | @Override
33 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
34 |
35 | }
36 |
37 | @Override
38 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
39 |
40 | }
41 |
42 | public boolean processContent() {
43 | return false;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/LIHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
27 |
28 | /**
29 | * Created by roberto on 04/09/15.
30 | */
31 | public class LIHandler extends TagHandler {
32 |
33 | @Override
34 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
35 |
36 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
37 | MarkupTag parent = context.getParent(tag,BaseListHandler.class);
38 |
39 | int nestedListsCount = BaseListHandler.getNestedListsCount();
40 |
41 | for (int index = 0; index < nestedListsCount; index ++) {
42 | out.append(SpannedBuilderUtils.TAB);
43 | }
44 |
45 | TagHandler parentHandler = parent.getTagHandler();
46 |
47 |
48 | if(parentHandler instanceof OLHandler){
49 | out.append( String.valueOf (((OLHandler)parentHandler).getNextIndex()));
50 | }else{
51 | out.append(SpannedBuilderUtils.BULLET);
52 | }
53 |
54 | out.append(SpannedBuilderUtils.SPACE);
55 | out.append(SpannedBuilderUtils.SPACE);
56 | }
57 |
58 | @Override
59 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
60 | SpannedBuilderUtils.ensureAtLeastThoseNewLines(out,1);
61 | }
62 |
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/OLHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 |
26 | /**
27 | * Created by roberto on 04/09/15.
28 | */
29 | public class OLHandler extends BaseListHandler {
30 |
31 |
32 | private int mIndex = 0;
33 |
34 |
35 | public int getNextIndex(){
36 | return ++ mIndex;
37 | }
38 |
39 | @Override
40 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | super.onTagOpen(context,tag,out);
42 | mIndex = 0;
43 |
44 | }
45 |
46 | @Override
47 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
48 | super.onTagClose(context, tag, out);
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SCRIPTHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class SCRIPTHandler extends IgnoreContentHandler {
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.spans.StrikethroughSpan;
23 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class SHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.startSpan(out, new Markers.Strike());
37 | }
38 |
39 | @Override
40 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | SpannedBuilderUtils.endSpan(out, Markers.Strike.class, new StrikethroughSpan());
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SMALLHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.spans.RelativeSizeSpan;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class SMALLHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.startSpan(out, new Markers.Small());
37 | }
38 |
39 | @Override
40 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | float smallText = context.getStyle().smallTextReduce();
42 | SpannedBuilderUtils.endSpan(out, Markers.Small.class, new RelativeSizeSpan(smallText));
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SOUNDCLOUDHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.text.TextUtils;
23 |
24 | import io.square1.richtextlib.EmbedUtils;
25 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 |
30 | /**
31 | * Created by roberto on 04/09/15.
32 | */
33 | public class SOUNDCLOUDHandler extends TagHandler {
34 |
35 | @Override
36 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
37 |
38 | String src = tag.attributes.getValue("", "url");
39 | src = EmbedUtils.getSoundCloudStream(src,"1f6456941b1176c22d44fb16ec2015a2");
40 | // mSpannableStringBuilder.append("\uFFFC");
41 | if(TextUtils.isEmpty(src) == false) {
42 | context.getRichText().onEmbedFound(EmbedUtils.TEmbedType.ESoundCloud, src);
43 | }
44 |
45 | }
46 |
47 | @Override
48 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
49 |
50 | }
51 |
52 | @Override
53 | public boolean closeWhenSplitting(){
54 | return false;
55 | }
56 |
57 |
58 | @Override
59 | public boolean openWhenSplitting(){
60 | return false;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SOURCEHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017. 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.richtextlib.v2.parser.handlers;
21 |
22 | import android.text.TextUtils;
23 |
24 | import org.xml.sax.Attributes;
25 |
26 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
27 | import io.square1.richtextlib.v2.parser.MarkupContext;
28 | import io.square1.richtextlib.v2.parser.MarkupTag;
29 | import io.square1.richtextlib.v2.parser.TagHandler;
30 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
31 |
32 | /**
33 | * Created by roberto on 13/09/2017.
34 | */
35 |
36 | public class SOURCEHandler extends TagHandler {
37 |
38 | @Override
39 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
40 |
41 | Markers.MarkerWithSource source = out.getLastSpan(Markers.MarkerWithSource.class);
42 | //if src is set in the audio or video tag we ignore this one
43 | if(source != null && TextUtils.isEmpty(source.src)){
44 | Attributes attributes = tag.attributes;
45 | source.src = attributes.getValue("", "src");
46 | source.type = attributes.getValue("", "type");
47 | }
48 | }
49 |
50 | @Override
51 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
52 |
53 | }
54 |
55 |
56 |
57 | public boolean processContent() {
58 | return false;
59 | }
60 |
61 |
62 | @Override
63 | public boolean closeWhenSplitting(){
64 | return false;
65 | }
66 |
67 |
68 | @Override
69 | public boolean openWhenSplitting(){
70 | return false;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/STRONGHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import android.graphics.Typeface;
23 |
24 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
25 | import io.square1.richtextlib.spans.StyleSpan;
26 | import io.square1.richtextlib.v2.parser.MarkupContext;
27 | import io.square1.richtextlib.v2.parser.MarkupTag;
28 | import io.square1.richtextlib.v2.parser.TagHandler;
29 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
30 |
31 | /**
32 | * Created by roberto on 04/09/15.
33 | */
34 | public class STRONGHandler extends TagHandler {
35 |
36 | @Override
37 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
38 | SpannedBuilderUtils.startSpan(out, new Markers.Bold());
39 |
40 | }
41 |
42 | @Override
43 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
44 | SpannedBuilderUtils.endSpan(out, Markers.Bold.class, new StyleSpan(Typeface.BOLD));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/STYLEHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class STYLEHandler extends IgnoreContentHandler {
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SUBHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.spans.SubscriptSpan;
23 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class SUBHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.startSpan(out, new Markers.Sub());
37 | }
38 |
39 | @Override
40 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
41 | SpannedBuilderUtils.endSpan(out, Markers.Sub.class, new SubscriptSpan());
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/SUPHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.spans.SuperscriptSpan;
23 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class SUPHandler extends TagHandler {
33 |
34 |
35 | @Override
36 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
37 | SpannedBuilderUtils.startSpan(out, new Markers.Sup());
38 | }
39 |
40 | @Override
41 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
42 | SpannedBuilderUtils.endSpan(out, Markers.Sup.class, new SuperscriptSpan());
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/TTHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.v2.parser.MarkupContext;
24 | import io.square1.richtextlib.v2.parser.MarkupTag;
25 | import io.square1.richtextlib.v2.parser.TagHandler;
26 |
27 | /**
28 | * Created by roberto on 04/09/15.
29 | */
30 | public class TTHandler extends TagHandler {
31 |
32 | @Override
33 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
34 |
35 | }
36 |
37 | @Override
38 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/UHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | import io.square1.richtextlib.v2.content.RichTextDocumentElement;
23 | import io.square1.richtextlib.spans.UnderlineSpan;
24 | import io.square1.richtextlib.v2.parser.MarkupContext;
25 | import io.square1.richtextlib.v2.parser.MarkupTag;
26 | import io.square1.richtextlib.v2.parser.TagHandler;
27 | import io.square1.richtextlib.v2.utils.SpannedBuilderUtils;
28 |
29 | /**
30 | * Created by roberto on 04/09/15.
31 | */
32 | public class UHandler extends TagHandler {
33 |
34 | @Override
35 | public void onTagOpen(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
36 | SpannedBuilderUtils.startSpan(out, new Markers.Underline());
37 |
38 | }
39 |
40 | @Override
41 | public void onTagClose(MarkupContext context, MarkupTag tag, RichTextDocumentElement out) {
42 | SpannedBuilderUtils.endSpan(out, Markers.Underline.class, new UnderlineSpan());
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/parser/handlers/ULHandler.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.richtextlib.v2.parser.handlers;
21 |
22 | /**
23 | * Created by roberto on 04/09/15.
24 | */
25 | public class ULHandler extends BaseListHandler {
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/richtext/src/main/java/io/square1/richtextlib/v2/utils/SpanUtils.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.richtextlib.v2.utils;
21 |
22 | import io.square1.richtextlib.spans.UrlBitmapDownloader;
23 | import io.square1.richtextlib.ui.RichContentViewDisplay;
24 |
25 | /**
26 | * Created by roberto on 08/09/15.
27 | */
28 | public class SpanUtils {
29 |
30 | public static UrlBitmapDownloader getDownloader(RichContentViewDisplay view){
31 |
32 | if(view == null) return null;
33 |
34 | if(view instanceof RichContentViewDisplay){
35 | return ((RichContentViewDisplay)view).getDownloader();
36 | }
37 |
38 | return null;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/close.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/fa_play_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/fa_play_circle.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/image.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/instagram_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/instagram_logo.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/placeholder.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/quote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/quote.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/vimeo_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/vimeo_play.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/vine_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/vine_logo.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xhdpi/youtube_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xhdpi/youtube_play.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xxhdpi/fullscreen_enter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xxhdpi/fullscreen_enter.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xxhdpi/fullscreen_exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xxhdpi/fullscreen_exit.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable-xxhdpi/place_holder_twitter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/square1-io/rich-text-android/20689a9ffb78db7ba0618db7d33d86242bd83408/richtext/src/main/res/drawable-xxhdpi/place_holder_twitter.png
--------------------------------------------------------------------------------
/richtext/src/main/res/drawable/place_holder_twitter_xml.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/internal_richtext_fragment_full_screen_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/internal_richtext_video_controller.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
21 |
22 |
29 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/internal_richtext_video_display.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
17 |
18 |
23 |
24 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/rich_text_embed_layout_oembed.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
25 |
32 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/rich_text_embed_layout_twitter_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/rich_text_embed_layout_webview.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/richtext/src/main/res/layout/test_rich_video_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/richtext/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/richtext/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 10dip
4 | 20dip
5 |
--------------------------------------------------------------------------------
/richtext/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | RichTextLib
4 | Please wait...
5 | There was a problem opening this link.
6 | Audio file not available
7 |
8 | 00:00:00
9 | There was an error playing this audio file.
10 | <p><span style="font-size:10px;">Small font</span>
11 | <span style="font-size:18px;">Large font</span>
12 | <span style="font-size:12px;color:orange;">Colored font</span>
13 | <span style="font-size:12px;font-weight:bold;">Bold font</span>
14 | <span style="font-size:12px;font-style:italic;">Italic font</span> and more...</p>
15 |
16 |
17 | Hello blank fragment
18 | Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
19 |
20 |
--------------------------------------------------------------------------------
/richtext/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':RichTextExample', ':richtext'
2 |
--------------------------------------------------------------------------------
/version.txt:
--------------------------------------------------------------------------------
1 | 6.0
--------------------------------------------------------------------------------