Android Open Source - TrafficChecker About Dialog






From Project

Back to project page TrafficChecker.

License

The source code is released under:

GNU General Public License

If you think the Android project TrafficChecker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 *  This File is licensed under GPL v3.//from  w ww  .  ja  v a 2  s.  com
 *  Copyright (C) 2012 Rene Peinthor.
 *
 *  This file is part of TrafficChecker.
 *
 *  BlueMouse is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  TrafficChecker is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with TrafficChecker.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.oldsch00l.TrafficChecker;

import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.widget.TextView;

public class AboutDialog {
  public static AlertDialog create(Context context) {
    final TextView message = new TextView(context);
    message.setPadding( 3, 3, 3, 3);
    // i.e.: R.string.dialog_message =>
    // "Test this dialog following the link to dtmilano.blogspot.com"
    ComponentName comp = new ComponentName(context, TrafficChecker.class);
    PackageInfo pinfo = null;
    try {
      pinfo = context.getPackageManager().getPackageInfo(
          comp.getPackageName(), 0);
    } catch (NameNotFoundException e) {
      e.printStackTrace();
    }
    String sMessage = String.format(context.getString(R.string.aboutdialogmessage), pinfo.versionName);
    final SpannableString s = new SpannableString(sMessage);
    Linkify.addLinks(s, Linkify.WEB_URLS);
    message.setText(s);
    message.setMovementMethod(LinkMovementMethod.getInstance());

    return new AlertDialog.Builder(context).setTitle(R.string.about)
        .setCancelable(true).setIcon(android.R.drawable.ic_dialog_info)
        .setPositiveButton(android.R.string.ok, null).setView(message).create();
  }
}




Java Source Code List

com.oldsch00l.TrafficChecker.AboutDialog.java
com.oldsch00l.TrafficChecker.AndroidSaxFeedParser.java
com.oldsch00l.TrafficChecker.AndroidSaxRSSParser.java
com.oldsch00l.TrafficChecker.BaseFeedParser.java
com.oldsch00l.TrafficChecker.CacheTrafficEntries.java
com.oldsch00l.TrafficChecker.GermanyRegions.java
com.oldsch00l.TrafficChecker.Message.java
com.oldsch00l.TrafficChecker.Preferences.java
com.oldsch00l.TrafficChecker.SelectRegionActivity.java
com.oldsch00l.TrafficChecker.TrafficAdapter.java
com.oldsch00l.TrafficChecker.TrafficChecker.java
com.oldsch00l.TrafficChecker.TrafficMapItemizedOverlay.java
com.oldsch00l.TrafficChecker.TrafficOverlay.java
com.oldsch00l.TrafficChecker.TrafficParser.java
com.oldsch00l.TrafficChecker.TrafficRegion.java