In my project I want to include a Dialog that shows the open source licences of the libraries I use in the application. Particularly though, I want them to look a lot like this:
That's how it looks on Github, I also noticed that Google plus for android includes a look-alike formatting for their OSLicences, but despite of trying, I can't really get it to look the same way.
So based on the Google Plus and Github implementations, I can get the following:
- A WebView is required to display the content.
- Github uses
pre
andcode
html tags to wrap the content.
I had read somewhere that I could use Prettyfy for this job. Well, I tried, but I'm not sure if I'm supposed to select a specific theme, or a specific language in the params, since on my end I have:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="prettify.js"></script>
<title>Open Source Licences</title>
</head>
and then for the body:
<body onload="prettyPrint()">
<pre class="prettyprint">
/*Copyright 2012 Jeremy Feinstein
*
*Licensed 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.
*/
</pre>
But my end result doesn't look all that great. Keep in mind I did try a not commenting the licence, but that result was even worse, since prettify was highlighting all of the keywords inside the licence.
Any ideas? Maybe it's something simpler than I thought, but I just can't figure it out.