Skip to content

Commit 2fe9f35

Browse files
committed
complete sdl plugin
1 parent 77c8124 commit 2fe9f35

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdlplugin/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ android {
2424
applicationId "com.duy.c.cpp.compiler.sdlplugin"
2525
minSdkVersion rootProject.ext.minSdkVersion
2626
targetSdkVersion rootProject.ext.targetSdkVersion
27-
versionCode 4
28-
versionName "1.0.4"
27+
versionCode 5
28+
versionName "1.0.5"
2929
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3030
ndk {
3131
abiFilters 'armeabi-v7a', 'x86'
@@ -36,8 +36,6 @@ android {
3636
main {
3737
manifest.srcFile 'AndroidManifest.xml'
3838
assets.srcDir 'assets'
39-
jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jniLibs
40-
jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk
4139
}
4240
}
4341

sdlplugin/src/main/java/com/duy/c/cpp/compiler/sdlplugin/sdlpluginActivity.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.content.DialogInterface;
88
import android.content.Intent;
99
import android.content.pm.PackageManager;
10-
import android.content.pm.PackageManager.NameNotFoundException;
1110
import android.net.Uri;
1211
import android.os.AsyncTask;
1312
import android.os.Build;
@@ -16,6 +15,7 @@
1615
import android.support.annotation.NonNull;
1716
import android.support.v4.app.ActivityCompat;
1817
import android.util.Log;
18+
import android.widget.Toast;
1919

2020
import 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) {

sdlplugin/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
<string name="sdl_ttf_version">SDL2_ttf version</string>
1818
<string name="install_cpp_nide">Install CPP NIDE</string>
1919
<string name="exit">Exit</string>
20+
<string name="open_wiki">Open wiki</string>
2021
</resources>

0 commit comments

Comments
 (0)