This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add a new component to support Html tags(can custom tag's implement) #2071
Open
brucetoo
wants to merge
14
commits into
apache:master
Choose a base branch
from
brucetoo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3647b59
[weex][android] fix the custom file ttf not work well, need replace u…
brucetoo 249a6d1
Merge pull request #1 from apache/master
brucetoo 329e269
[Android] Support RichText by a special way to render html string
brucetoo df2bd63
[Android] Support RichText by a special way to render html string
brucetoo 0fdf9fa
1. support <video> render by native custom view
brucetoo a259089
1、improve image/text default implement
brucetoo 8e7c489
1、WxHtmlComponent add header&footer support
brucetoo 10c5576
fix a problem cause render failed when text span's length is 0
brucetoo 6216165
add tagName params in extended methods for better user control
brucetoo 2478df1
fix extract font-size exception,cause by complicate style info
brucetoo dc2cdf7
fix original htmlCompat style only can parse the standard formatted a…
brucetoo e42a902
add header&footer appear&disappear event support
brucetoo 30cb2ca
fix htmlOption NPE when only a part of options are configured
brucetoo 38f2688
fix bug that header view will be clipped(top margin problem) in some …
brucetoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
android/sdk/src/main/java/com/taobao/weex/adapter/IWxHtmlTagAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package com.taobao.weex.adapter; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
|
||
import com.taobao.weex.ui.component.html.WxHtmlComponent; | ||
|
||
/** Created by Bruce Too On 2019/1/10. At 09:39 */ | ||
public interface IWxHtmlTagAdapter<T extends View> { | ||
/** | ||
* Custom html tags mapped with native view,see the default implement at {@link | ||
* com.taobao.weex.ui.component.html.adapter.DefaultHtmlTagAdapter} | ||
* | ||
* @param context current activity context | ||
* @param tagName tag's name | ||
* @param html html string | ||
* @return the custom native view self | ||
*/ | ||
public T getHtmlTagView(Context context, WxHtmlComponent component, String tagName, String html); | ||
|
||
public View.OnClickListener getTagViewClickListener(View clickView, String tagName, String html); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
android/sdk/src/main/java/com/taobao/weex/ui/component/html/AtMostWebView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package com.taobao.weex.ui.component.html; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.webkit.WebView; | ||
|
||
/** | ||
* Created by Bruce Too | ||
* On 2019/1/9. | ||
* At 13:51 | ||
*/ | ||
public class AtMostWebView extends WebView { | ||
public AtMostWebView(Context context) { | ||
super(context); | ||
} | ||
|
||
public AtMostWebView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public AtMostWebView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
@Override | ||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
int heightSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); | ||
super.onMeasure(widthMeasureSpec, heightSpec); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this outcommented code left here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change this ImageAdapter because the origin has many conditions about how to display image. It's in demo project, so not the key core code