Go to the documentation of this file.00001
00005 package com.introlab.rtabmap;
00006
00007 import java.io.BufferedReader;
00008 import java.io.IOException;
00009 import java.io.InputStream;
00010 import java.io.InputStreamReader;
00011
00012 import android.app.Dialog;
00013 import android.content.Context;
00014 import android.graphics.Color;
00015 import android.os.Bundle;
00016 import android.text.Html;
00017 import android.text.method.LinkMovementMethod;
00018 import android.text.util.Linkify;
00019 import android.widget.TextView;
00020
00021 public class AboutDialog extends Dialog{
00022
00023 private static Context mContext = null;
00024
00025 public AboutDialog(Context context) {
00026 super(context);
00027 mContext = context;
00028 }
00029
00033 @Override
00034 public void onCreate(Bundle savedInstanceState) {
00035 setContentView(R.layout.about);
00036 TextView tv = (TextView)findViewById(R.id.info_text);
00037 tv.setText(Html.fromHtml(readRawTextFile(R.raw.info)));
00038 tv.setMovementMethod(LinkMovementMethod.getInstance());
00039 tv.setLinkTextColor(Color.WHITE);
00040 Linkify.addLinks(tv, Linkify.ALL);
00041 tv.append(Html.fromHtml("<b><a href=http://introlab.github.io/rtabmap/index.html#privacy-policy>Privacy Policy</a></b>"));
00042 }
00043
00044 public static String readRawTextFile(int id) {
00045 InputStream inputStream = mContext.getResources().openRawResource(id);
00046 InputStreamReader in = new InputStreamReader(inputStream);
00047 BufferedReader buf = new BufferedReader(in);
00048 String line;
00049 StringBuilder text = new StringBuilder();
00050 try {
00051 while (( line = buf.readLine()) != null) text.append(line);
00052 } catch (IOException e) {
00053 return null;
00054 }
00055 return text.toString();
00056 }
00057
00058 }