• Stars
    star
    126
  • Rank 274,325 (Top 6 %)
  • Language
    Java
  • Created about 8 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Codeview is an Android library that lets you preview code in webview very easy and simple with highlights and colors.

Codeview


http://avraampiperidis.github.io/Codeview/
Android Arsenal

Codeview is a android library tha lets you preview code in webview very easy and simple with highlighs and colors. With styles to chooses and language.

Also you can inject html and text into webview or any extended webview class.

This library was inspired and is working thanks to highlight.js.
Apps using Codeview library.
https://play.google.com/store/apps/details?id=com.protectsoft.javatutorial
https://play.google.com/store/apps/details?id=com.protectsoft.pythontutorial

https://bintray.com/zeronerone/maven/Codeview#statistics

Usage

Codeview

Download/Install Gradle


repositories {
        jcenter()
    }
    
compile 'Codeview-1.0.0:webviewcode:1.0.0' 
1) Get a reference to your WebView or any extended WebView
WebView webview = (WebView) findViewById(R.id.webview);
//set settings here
2) Basic usage. Default style is Original, and default language is java.
//your string code 
String code = "public static void main(String[] args) { \n" +
                "\n" +
                "//comments\n" +
                "   for(int i =0; i < 10; i++) {\n" +
                "       addnum();\n" +
                "   }\n" +
                "\n" +
                "}\n";
								
Codeview.with(getApplicationContext())
		.withCode(code)
		.into(webview);

3) set style and language.
MyTouchWebView webview = (MyTouchWebView) findViewById(R.id.mytouchwebview);
//set settings here
//your string java code 
String code = "public static void main(String[] args) { \n" +
                "\n" +
                "//comments\n" +
                "   for(int i =0; i < 10; i++) {\n" +
                "       addnum();\n" +
                "   }\n" +
                "\n" +
                "}\n";
								
Codeview.with(getApplicationContext())
		.withCode(code)
		.setStyle(Settings.WithStyle.DARKULA)
        .setLang(Settings.Lang.JAVA)
		.into(webview);

4) Inject html head content and text.
WebView webview = (WebView) findViewById(R.id.webview);
//set settings here
//your string javascript code
        String code = "function Constructor(v1,v2,v3)\n" +
                "{\n" +
                "  this.v1 = v1;\n" +
                "  this.v2 = v2;\n" +
                "  this.funk = function()\n" +
                "  {\n" +
                "    console.log(\"Test: \"+ v3 );\n" +
                "  }\n" +
                "}\n" +
                "\n" +
                "var obj1 = new Constructor(\"par1\",\"par2\",\"par3\");\n" +
                "var arr = [\"w1\",\"w2\",\"w3\",obj1];\n" +
                "\n" +
                "function f2()\n" +
                "{            \n" +
                "  obj1.funk(); //works ok\n" +
                "  console.log(\"test \"+tablica[3].funk.call() ); //doesn't work\n" +
                "}";
                
                
        Codeview.with(getApplicationContext())
                .setHtmlHeadContent("<style> table,tr,td {" +
                        " border: 1px solid black;" +
                        " }" +
                        "" +
                        "</style>")
                .withHtml("<h1> h1 injected header</h1>")
                .withText("this text is always wrap inside pre tags")
                .withCode(code)
                .withHtml("<h1> h1 header after code </h1>")
                .withHtml("<table><tr><td> my html table </td></tr></table>")
                .setStyle(Settings.WithStyle.DARKSTYLE)
                .setLang(Settings.Lang.JAVASCRIPT)
                .setAutoWrap(true)
                .into(webView);

License

MIT License

Copyright (c) 2016 Avraam Piperidis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

ng-fullyearcalendar

A full year calendar library for angular
TypeScript
38
star
2

maven_multi_module_project_example

Maven multi module app project example
Java
27
star
3

ApiEE

a Java EE/Spring Web Framework to develop Java EE/Spring three tier web applications fast.
Java
25
star
4

AndroidCamera

An open source camera app for android
Java
22
star
5

ArqWarLoader

A simple Arquillian .war loader
Java
17
star
6

RemoteDesktop

RemoteDesktopController java/fx/JNI-c++
Java
14
star
7

parameterizednunit

Parameterized test example in .NET core using NUnit
C#
14
star
8

LightBox

Multi database, light fast IDE
C#
13
star
9

SqlStatementParser

Determine statement ranges in sql string based on the semicolon
C++
11
star
10

Mediator

a java testing library for json skeletons/data matching between apps
Java
11
star
11

excaliburJsAngular4

excaliburJs games in angular 4
TypeScript
11
star
12

SimpleJavaIDE

a Simple javafx ide
Java
7
star
13

phpPanel

a very light,simple,fast mysql administration tool
PHP
6
star
14

imdb_pyscraper

python program that scraps imdb.com and stores data into mysql db
Python
5
star
15

JavaDocExtractor

extract classes, methods and descriptions/texts from the official oracle java html documentaion into sqlite database
Java
4
star
16

jsp-jstl-servlet-tomcat_e-shop-example

Java
3
star
17

AWS-Java-Android-Pythonexamples-samples

Amazon Web Services samples/examples java-android-python
Java
3
star
18

4dgl_oled160-g2_notifier

Java
3
star
19

box

A php file storage and share website,it was for university course.
PHP
3
star
20

node-js-web-chat

node js (socket.io-mongodb)web chat template
JavaScript
2
star
21

LayoutRefactor

android layout xml refactor.
Java
2
star
22

StackOverflowQAParser

java library that grabs questions and answers from stackoverflow.com from a question
Java
1
star