77import android .content .DialogInterface ;
88import android .content .Intent ;
99import android .content .pm .PackageManager ;
10- import android .content .pm .PackageManager .NameNotFoundException ;
1110import android .net .Uri ;
1211import android .os .AsyncTask ;
1312import android .os .Build ;
1615import android .support .annotation .NonNull ;
1716import android .support .v4 .app .ActivityCompat ;
1817import android .util .Log ;
18+ import android .widget .Toast ;
1919
2020import org .libsdl .app .SDLActivity ;
2121
@@ -27,7 +27,7 @@ public class sdlpluginActivity extends SDLActivity {
2727 private static final String TAG = "sdlpluginActivity" ;
2828 private static final int RC_PERMISSION_WRITE_EXTERNAL_STORAGE = 2 ;
2929
30- private static final String CPP_NIDE_WIKI_URL = "https://github.com/tranleduy2000/c_cpp_compiler/wiki/" ;
30+ private static final String CPP_NIDE_WIKI_URL = "https://github.com/tranleduy2000/c_cpp_compiler/wiki/SDL-Plugin " ;
3131
3232 private File mSdCardAppDir ;
3333
@@ -82,25 +82,29 @@ private void initUI() {
8282 }
8383
8484 private void showAboutDialog () {
85- String versionName ;
86- try {
87- versionName = getPackageManager ().getPackageInfo (getPackageName (), 0 ).versionName ;
88- } catch (NameNotFoundException e ) {
89- versionName = "1.0" ;
90- }
91- String message = getString (R .string .about_dialog_text ) +
92- " " + versionName + "\n " +
85+ String message = getString (R .string .about_dialog_text ) + " " + BuildConfig .VERSION_NAME + "\n " +
9386 getString (R .string .sdl_version ) + " " + Utils .getSDLVersion (Utils .Lib_SDL ) + "\n " +
9487 getString (R .string .sdl_image_version ) + " " + Utils .getSDLVersion (Utils .Lib_SDL_image ) + "\n " +
9588 getString (R .string .sdl_mixer_version ) + " " + Utils .getSDLVersion (Utils .Lib_SDL_mixer ) + "\n " +
9689 getString (R .string .sdl_net_version ) + " " + Utils .getSDLVersion (Utils .Lib_SDL_net ) + "\n " +
9790 getString (R .string .sdl_ttf_version ) + " " + Utils .getSDLVersion (Utils .Lib_SDL_ttf ) + "\n \n " +
98- getString (R .string .about_dialog_text3 ) + "\n " +
99- CPP_NIDE_WIKI_URL + "\n " ;
91+ getString (R .string .about_dialog_text3 ) + "\n " + CPP_NIDE_WIKI_URL + "\n " ;
10092
10193 AlertDialog .Builder builder = new AlertDialog .Builder (this )
10294 .setTitle (getString (R .string .about_dialog ))
10395 .setMessage (message )
96+ .setNeutralButton (R .string .open_wiki , new DialogInterface .OnClickListener () {
97+ @ Override
98+ public void onClick (DialogInterface dialog , int which ) {
99+ try {
100+ Intent browserIntent = new Intent (Intent .ACTION_VIEW , Uri .parse (CPP_NIDE_WIKI_URL ));
101+ startActivity (browserIntent );
102+ } catch (Exception e ) {
103+ Toast .makeText (sdlpluginActivity .this , e .getMessage (), Toast .LENGTH_SHORT ).show ();
104+ }
105+ dialog .cancel ();
106+ }
107+ })
104108 .setNegativeButton (R .string .exit , new DialogInterface .OnClickListener () {
105109 @ Override
106110 public void onClick (DialogInterface dialog , int which ) {
0 commit comments