package tk.djcrazy.MyCC98.dialog;

import tk.djcrazy.MyCC98.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.widget.Button;

public class AboutDialog extends Dialog {
	WebView webView;
	Button okButton;

	public AboutDialog(Context context) {
		super(context);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_about);
		setTitle("About");
		webView = (WebView) findViewById(R.id.about_web_view);
		okButton = (Button) findViewById(R.id.about_ok);
		webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
		Animation animation = AnimationUtils.loadAnimation(getContext(),
				R.anim.alpha_change);
		webView.startAnimation(animation);
		webView.loadUrl("file:///android_asset/about.html");
		okButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				dismiss();
			}
		});
	}

}

@@ -115,16 +115,97 @@
 ontext;%0A
+import android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0A
 import a
@@ -448,16 +448,53 @@
 utton;%0A%0A
+import com.orhanobut.logger.Logger;%0A%0A
 public c
@@ -527,16 +527,66 @@
 ialog %7B%0A
+    public static final String TAG=%22AboutDialog%22;%0A
 %09WebView
@@ -612,16 +612,42 @@
 kButton;
+%0A    Context upperContext;
 %0A%0A%09publi
@@ -697,16 +697,46 @@
 ntext);%0A
+        upperContext=context;%0A
 %09%7D%0A%0A%09@Ov
@@ -887,16 +887,32 @@
 tle(
+setTitleVersion(
 %22About%22)
 ;%0A%09%09
@@ -907,16 +907,17 @@
 %22About%22)
+)
 ;%0A%09%09webV
@@ -1388,35 +1388,1051 @@
 ) %7B%0A
-%09%09%09%09dismiss();%0A%09%09%09%7D%0A%09%09%7D);%0A%09
+                upperContext=null;%0A%09%09%09%09dismiss();%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%0A%09private String setTitleVersion(String mainheader)%7B%0A        StringBuilder cat=new StringBuilder(mainheader);%0A        String versionname=GetPackageInfomation.getPackageVersionName(upperContext);%0A%0A        return cat.append('-').append(versionname).toString();%0A    %7D%0A    public static class GetPackageInfomation%7B%0A        public static String name;%0A        public static final String ERROR_NAME=%22VersionName Error%22;%0A%0A        public static String getPackageVersionName(Context context)%7B%0A%0A            PackageManager pm =context.getPackageManager();%0A%0A            try %7B%0A                PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);%0A                //getPackageName()%E6%98%AF%E4%BD%A0%E5%BD%93%E5%89%8D%E7%B1%BB%E7%9A%84%E5%8C%85%E5%90%8D%EF%BC%8C0%E4%BB%A3%E8%A1%A8%E6%98%AF%E8%8E%B7%E5%8F%96%E7%89%88%E6%9C%AC%E4%BF%A1%E6%81%AF%0A                name= pi.versionName;%0A                //int code = pi.versionCode;%0A%0A            %7Dcatch (PackageManager.NameNotFoundException e)%7B%0A                Logger.t(TAG).e(ERROR_NAME,e);%0A                name=ERROR_NAME;%0A%0A            %7D%0A            return name;%0A%0A        %7D%0A    
 %7D%0A%0A%7D

add version in About