Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Sugar
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王海
Sugar
Commits
16605465
Commit
16605465
authored
Apr 24, 2017
by
Sendtion
Committed by
GitHub
Apr 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from bravekingzhang/master
增加动态计算插入图片的高度
parents
23536c25
71be65e9
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
345 additions
and
391 deletions
+345
-391
.idea/encodings.xml
.idea/encodings.xml
+0
-6
.idea/markdown-navigator.xml
.idea/markdown-navigator.xml
+0
-68
.idea/misc.xml
.idea/misc.xml
+1
-1
.idea/modules.xml
.idea/modules.xml
+0
-3
xrichtext/src/main/java/com/sendtion/xrichtext/RichTextEditor.java
.../src/main/java/com/sendtion/xrichtext/RichTextEditor.java
+331
-303
xrichtext/src/main/java/com/sendtion/xrichtext/RichTextView.java
...xt/src/main/java/com/sendtion/xrichtext/RichTextView.java
+13
-10
No files found.
.idea/encodings.xml
deleted
100644 → 0
View file @
23536c25
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Encoding"
>
<file
url=
"PROJECT"
charset=
"UTF-8"
/>
</component>
</project>
\ No newline at end of file
.idea/markdown-navigator.xml
deleted
100644 → 0
View file @
23536c25
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"MarkdownProjectSettings"
>
<PreviewSettings
splitEditorLayout=
"SPLIT"
splitEditorPreview=
"PREVIEW"
useGrayscaleRendering=
"false"
zoomFactor=
"1.0"
maxImageWidth=
"0"
showGitHubPageIfSynced=
"false"
allowBrowsingInPreview=
"false"
synchronizePreviewPosition=
"true"
highlightPreviewType=
"NONE"
highlightFadeOut=
"5"
highlightOnTyping=
"true"
synchronizeSourcePosition=
"true"
>
<PanelProvider>
<provider
providerId=
"com.vladsch.idea.multimarkdown.editor.swing.html.panel"
providerName=
"Default - Swing"
/>
</PanelProvider>
</PreviewSettings>
<ParserSettings>
<PegdownExtensions>
<option
name=
"ABBREVIATIONS"
value=
"false"
/>
<option
name=
"ANCHORLINKS"
value=
"true"
/>
<option
name=
"ATXHEADERSPACE"
value=
"true"
/>
<option
name=
"AUTOLINKS"
value=
"true"
/>
<option
name=
"DEFINITIONS"
value=
"false"
/>
<option
name=
"FENCED_CODE_BLOCKS"
value=
"true"
/>
<option
name=
"FOOTNOTES"
value=
"false"
/>
<option
name=
"HARDWRAPS"
value=
"false"
/>
<option
name=
"INSERTED"
value=
"false"
/>
<option
name=
"QUOTES"
value=
"false"
/>
<option
name=
"RELAXEDHRULES"
value=
"true"
/>
<option
name=
"SMARTS"
value=
"false"
/>
<option
name=
"STRIKETHROUGH"
value=
"true"
/>
<option
name=
"SUBSCRIPT"
value=
"false"
/>
<option
name=
"SUPERSCRIPT"
value=
"false"
/>
<option
name=
"SUPPRESS_HTML_BLOCKS"
value=
"false"
/>
<option
name=
"SUPPRESS_INLINE_HTML"
value=
"false"
/>
<option
name=
"TABLES"
value=
"true"
/>
<option
name=
"TASKLISTITEMS"
value=
"true"
/>
<option
name=
"TOC"
value=
"false"
/>
<option
name=
"WIKILINKS"
value=
"true"
/>
</PegdownExtensions>
<ParserOptions>
<option
name=
"COMMONMARK_LISTS"
value=
"false"
/>
<option
name=
"DUMMY"
value=
"false"
/>
<option
name=
"EMOJI_SHORTCUTS"
value=
"true"
/>
<option
name=
"FLEXMARK_FRONT_MATTER"
value=
"false"
/>
<option
name=
"GFM_TABLE_RENDERING"
value=
"true"
/>
<option
name=
"GITBOOK_URL_ENCODING"
value=
"false"
/>
<option
name=
"GITHUB_EMOJI_URL"
value=
"false"
/>
<option
name=
"GITHUB_LISTS"
value=
"true"
/>
<option
name=
"GITHUB_WIKI_LINKS"
value=
"true"
/>
<option
name=
"JEKYLL_FRONT_MATTER"
value=
"false"
/>
<option
name=
"SIM_TOC_BLANK_LINE_SPACER"
value=
"true"
/>
</ParserOptions>
</ParserSettings>
<HtmlSettings
headerTopEnabled=
"false"
headerBottomEnabled=
"false"
bodyTopEnabled=
"false"
bodyBottomEnabled=
"false"
embedUrlContent=
"false"
addPageHeader=
"true"
>
<GeneratorProvider>
<provider
providerId=
"com.vladsch.idea.multimarkdown.editor.swing.html.generator"
providerName=
"Default Swing HTML Generator"
/>
</GeneratorProvider>
<headerTop
/>
<headerBottom
/>
<bodyTop
/>
<bodyBottom
/>
</HtmlSettings>
<CssSettings
previewScheme=
"UI_SCHEME"
cssUri=
""
isCssUriEnabled=
"false"
isCssTextEnabled=
"false"
isDynamicPageWidth=
"true"
>
<StylesheetProvider>
<provider
providerId=
"com.vladsch.idea.multimarkdown.editor.swing.html.css"
providerName=
"Default Swing Stylesheet"
/>
</StylesheetProvider>
<ScriptProviders
/>
<cssText
/>
</CssSettings>
<HtmlExportSettings
updateOnSave=
"false"
parentDir=
"$ProjectFileDir$"
targetDir=
"$ProjectFileDir$"
cssDir=
""
scriptDir=
""
plainHtml=
"false"
imageDir=
""
copyLinkedImages=
"false"
imageUniquifyType=
"0"
targetExt=
""
useTargetExt=
"false"
noCssNoScripts=
"false"
linkToExportedHtml=
"true"
exportOnSettingsChange=
"true"
regenerateOnProjectOpen=
"false"
/>
<LinkMapSettings>
<textMaps
/>
</LinkMapSettings>
</component>
</project>
\ No newline at end of file
.idea/misc.xml
View file @
16605465
...
...
@@ -37,7 +37,7 @@
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"
1.8
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"
JDK
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
.idea/modules.xml
View file @
16605465
...
...
@@ -3,10 +3,7 @@
<component
name=
"ProjectModuleManager"
>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/XRichText.iml"
filepath=
"$PROJECT_DIR$/XRichText.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/XRichTextDemo.iml"
filepath=
"$PROJECT_DIR$/XRichTextDemo.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/app/app.iml"
filepath=
"$PROJECT_DIR$/app/app.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/app/app.iml"
filepath=
"$PROJECT_DIR$/app/app.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/xrichtext/xrichtext.iml"
filepath=
"$PROJECT_DIR$/xrichtext/xrichtext.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/xrichtext/xrichtext.iml"
filepath=
"$PROJECT_DIR$/xrichtext/xrichtext.iml"
/>
</modules>
</component>
...
...
xrichtext/src/main/java/com/sendtion/xrichtext/RichTextEditor.java
View file @
16605465
This diff is collapsed.
Click to expand it.
xrichtext/src/main/java/com/sendtion/xrichtext/RichTextView.java
View file @
16605465
...
...
@@ -43,7 +43,7 @@ public class RichTextView extends ScrollView {
//allLayout.setBackgroundColor(Color.WHITE);//去掉背景
LayoutParams
layoutParams
=
new
LayoutParams
(
LayoutParams
.
MATCH_PARENT
,
LayoutParams
.
WRAP_CONTENT
);
allLayout
.
setPadding
(
50
,
15
,
50
,
15
);
//设置间距,防止生成图片时文字太靠边
allLayout
.
setPadding
(
50
,
15
,
50
,
15
);
//设置间距,防止生成图片时文字太靠边
addView
(
allLayout
,
layoutParams
);
LinearLayout
.
LayoutParams
firstEditParam
=
new
LinearLayout
.
LayoutParams
(
...
...
@@ -61,15 +61,16 @@ public class RichTextView extends ScrollView {
/**
* 清除所有的view
*/
public
void
clearAllLayout
(){
public
void
clearAllLayout
()
{
allLayout
.
removeAllViews
();
}
/**
* 获得最后一个子view的位置
*
* @return
*/
public
int
getLastIndex
(){
public
int
getLastIndex
()
{
int
lastEditIndex
=
allLayout
.
getChildCount
();
return
lastEditIndex
;
}
...
...
@@ -100,10 +101,8 @@ public class RichTextView extends ScrollView {
/**
* 在特定位置插入EditText
*
* @param index
* 位置
* @param editStr
* EditText显示的文字
* @param index 位置
* @param editStr EditText显示的文字
*/
public
void
addTextViewAtIndex
(
final
int
index
,
CharSequence
editStr
)
{
TextView
textView
=
createTextView
(
""
,
EDIT_PADDING
);
...
...
@@ -126,7 +125,12 @@ public class RichTextView extends ScrollView {
imageView
.
setAbsolutePath
(
imagePath
);
// 调整imageView的高度
int
imageHeight
=
allLayout
.
getWidth
()
*
bmp
.
getHeight
()
/
bmp
.
getWidth
();
int
imageHeight
=
500
;
if
(
bmp
!=
null
)
{
imageHeight
=
allLayout
.
getWidth
()
*
bmp
.
getHeight
()
/
bmp
.
getWidth
();
// 使用之后,还是回收掉吧
bmp
.
recycle
();
}
RelativeLayout
.
LayoutParams
lp
=
new
RelativeLayout
.
LayoutParams
(
LayoutParams
.
MATCH_PARENT
,
imageHeight
);
lp
.
bottomMargin
=
10
;
...
...
@@ -138,8 +142,7 @@ public class RichTextView extends ScrollView {
/**
* 根据view的宽度,动态缩放bitmap尺寸
*
* @param width
* view的宽度
* @param width view的宽度
*/
public
Bitmap
getScaledBitmap
(
String
filePath
,
int
width
)
{
BitmapFactory
.
Options
options
=
new
BitmapFactory
.
Options
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment