{"id":13645393,"url":"https://github.com/tiagohm/CodeView","last_synced_at":"2025-04-21T14:30:45.049Z","repository":{"id":41233467,"uuid":"79064922","full_name":"tiagohm/CodeView","owner":"tiagohm","description":"Android Code Highlighter","archived":true,"fork":false,"pushed_at":"2017-08-03T23:14:19.000Z","size":3429,"stargazers_count":214,"open_issues_count":2,"forks_count":29,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-07T21:51:31.698Z","etag":null,"topics":["android","android-library","highlighter","syntax-highlighting","view"],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiagohm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-15T22:53:09.000Z","updated_at":"2025-03-27T23:22:52.000Z","dependencies_parsed_at":"2022-07-28T21:18:52.092Z","dependency_job_id":null,"html_url":"https://github.com/tiagohm/CodeView","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagohm%2FCodeView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagohm%2FCodeView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagohm%2FCodeView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagohm%2FCodeView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiagohm","download_url":"https://codeload.github.com/tiagohm/CodeView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070173,"owners_count":21369839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","highlighter","syntax-highlighting","view"],"created_at":"2024-08-02T01:02:34.419Z","updated_at":"2025-04-21T14:30:44.674Z","avatar_url":"https://github.com/tiagohm.png","language":"CSS","readme":"# CodeView\n### Android Code Highlighter\n\n[![](https://jitpack.io/v/tiagohm/CodeView.svg)](https://jitpack.io/#tiagohm/CodeView)\n\n## Install\nAdd it in your root `build.gradle` at the end of repositories:\n```gradle\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nAdd the dependency:\n```gradle\ncompile 'com.github.tiagohm:CodeView:LATEST-VERSION\n```\n\n## Features\n* Powered by Highlight.js\n* 176 languages and 79 styles\n* Wrap Line\n* Language Detection\n* Zoom (Pinch gesture)\n* Line Number\n* Line Count\n* Highlight current line (by click/tap)\n* Highlight line\n* Tap event of lines (get line number and your content)\n\n## Usage\n\nAdd view to your layout:\n```xml\n\u003cbr.tiagohm.codeview.CodeView\n        android:id=\"@+id/codeView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:cv_font_size=\"14\"\n        app:cv_highlight_line_number=\"36\"\n        app:cv_show_line_number=\"true\"\n        app:cv_start_line_number=\"0\"\n        app:cv_wrap_line=\"true\"\n        app:cv_zoom_enable=\"true\"\u003e\n    \u003c/br.tiagohm.codeview.CodeView\u003e\n ```\n ```java\n mCodeView = (CodeView)findViewById(R.id.codeView);\n\n mCodeView.setOnHighlightListener(this)\n       .setOnHighlightListener(this)\n       .setTheme(Theme.AGATE)\n       .setCode(JAVA_CODE)\n       .setLanguage(Language.JAVA)\n       .setWrapLine(true)\n       .setFontSize(14)\n       .setZoomEnabled(true)\n       .setShowLineNumber(true)\n       .setStartLineNumber(9000)\n       .apply();\n ```\n\n## Other Methods\n```java\nmCodeView.highlightLineNumber(10);\nmCodeView.toggleLineNumber();\nmCodeView.getLineCount();\n```\n\n Listeners:\n\n ```java\n //Interface\n new CodeView.OnHighlightListener()\n {\n  @Override\n  public void onStartCodeHighlight()\n  {   \n    mProgressDialog = ProgressDialog.show(this, null, \"Carregando...\", true);\n  }\n\n  @Override\n  public void onFinishCodeHighlight()\n  {\n    if (mProgressDialog != null) {\n      mProgressDialog.dismiss();\n    }\n  }\n\n  @Override\n  public void onLanguageDetected(Language language, int relevance) {\n   Toast.makeText(this, \"language: \" + language + \" relevance: \" + relevance, Toast.LENGTH_SHORT).show();\n  }\n\n  @Override\n  public void onFontSizeChanged(int sizeInPx) {\n   Log.d(\"TAG\", \"font-size: \" + sizeInPx + \"px\");\n  }\n\n  @Override\n  public void onLineClicked(int lineNumber, String content) {\n    Toast.makeText(this, \"line: \" + lineNumber + \" html: \" + content, Toast.LENGTH_SHORT).show();\n  }\n}\n ```\n\n ![](https://raw.githubusercontent.com/tiagohm/CodeView/master/1.png)\n","funding_links":[],"categories":["编辑器"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagohm%2FCodeView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagohm%2FCodeView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagohm%2FCodeView/lists"}