Skip to content
Snippets Groups Projects
Commit 5ed7618e authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Android: add about activity

parent 5f642283
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,9 @@
<activity
android:name=".ModelList"
android:label="@string/title_activity_main" />
<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about" />
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
......
......@@ -7,6 +7,7 @@
<string name="dialog_title_choosefile">Choose a file</string>
<string name="error_nosdcard">No SDcard found on your device</string>
<string name="title_activity_main">Onelab</string>
<string name="title_activity_about">About</string>
<string name="title_activity_options">Parameters</string>
<string name="error_nomshfile">No compatible files or directories in this folder</string>
<string name="title_share">Share screenshot with &#8230;</string>
......@@ -17,4 +18,4 @@
<string name="postpro_intervalstype">Intervals type</string>
<string name="postpro_intervals">Intervals</string>
<string name="postpro_raisez">Raise (Z)</string>
</resources>
\ No newline at end of file
</resources>
package org.geuz.onelab;
import java.lang.String;
import android.app.Activity;
import android.webkit.WebView;
public class AboutActivity extends Activity{
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webview = new WebView(this);
String aboutGmsh = Gmsh.getAboutGmsh();
String aboutGetDP = Gmsh.getAboutGetDP();
String aboutOnelab = "<center><h3>Onelab/Mobile</h3>";
try {
aboutOnelab += "Version "+this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
}
catch (android.content.pm.PackageManager.NameNotFoundException e) {
aboutOnelab += "Version ?.?.?";
}
aboutOnelab += "<p>Copyright (C) 2014<br>Maxime Graulich and Christophe Geuzaine, University of Li&egrave;ge</p>";
aboutOnelab += "<p>Visit <a href=\"http://onelab.info/\">http://onelab.info/</a> for more information</p>";
webview.loadDataWithBaseURL("", aboutOnelab + aboutGmsh + aboutGetDP, "text/html", "UTF-8", "");
setContentView(webview);
}
}
......@@ -37,6 +37,9 @@ public class Gmsh implements Parcelable {
public native int animationPrev();
public native void setAnimation(int animation);
public static native String getAboutGmsh();
public static native String getAboutGetDP();
/** Java CLASS **/
private long ptr;
private Handler handler;
......
......@@ -104,6 +104,8 @@ public class ModelList extends Activity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem about = menu.add("About");
about.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
MenuItem loadFile = menu.add(R.string.button_open_file);
loadFile.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
return super.onCreateOptionsMenu(menu);
......@@ -122,6 +124,10 @@ public class ModelList extends Activity {
Toast.makeText(this, "No application found on your device to open the files.", Toast.LENGTH_LONG).show();
}
}
else if(item.getTitle().equals("About")) {
Intent intent = new Intent(ModelList.this, AboutActivity.class);
startActivity(intent);
}
return super.onMenuItemSelected(featureId, item);
}
......
......@@ -6,6 +6,8 @@
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#include <gmsh/Gmsh.h>
#include <gmsh/GmshConfig.h>
#include <gmsh/GmshVersion.h>
#include <gmsh/GModel.h>
#include <gmsh/onelab.h>
#include <gmsh/onelabUtils.h>
......@@ -14,6 +16,9 @@
#include <gmsh/PViewData.h>
#include <gmsh/PViewOptions.h>
#include <getdp/GetDPConfig.h>
#include <getdp/GetDPVersion.h>
#include "androidGModel.h"
#include "drawContext.h"
......@@ -326,4 +331,46 @@ extern "C" {
{
set_animation(animation);
}
JNIEXPORT jstring JNICALL Java_org_geuz_onelab_Gmsh_getAboutGmsh
(JNIEnv *env, jclass c)
{
std::ostringstream sstream;
sstream << "<center><h3>Gmsh</h3><br>version " << GMSH_VERSION
<< "<p>Copyright (C) 1997-2014"
<< "<br>Christophe Geuzaine and Jean-Francois Remacle"
<< "<p><a href=\"http://geuz.org/gmsh/doc/CREDITS.txt\">Credits</a> "
<< "and <a href=\"http://geuz.org/gmsh/doc/LICENSE.txt\">licensing "
<< "information</a>"
<< "<p>Please send all questions and bug reports to "
<< "<a href=\"mailto:gmsh@geuz.org\">gmsh@geuz.org</a></center>"
<< "<ul>"
<< "<li><i>Build OS:</i> " << GMSH_OS
<< "<li><i>Build date:</i> " << GMSH_DATE
<< "<li><i>Build options:</i>" << GMSH_CONFIG_OPTIONS
<< "</ul>"
<< "<center>Visit <a href=\"http://geuz.org/gmsh/\">http://geuz.org/gmsh/</a> "
<< "for more information</center>";
return env->NewStringUTF(sstream.str().c_str());
}
JNIEXPORT jstring JNICALL Java_org_geuz_onelab_Gmsh_getAboutGetDP
(JNIEnv *env, jclass c)
{
std::ostringstream sstream;
sstream << "<center><h3>GetDP</h3><br>version " << GETDP_VERSION
<< "<p>Copyright (C) 1997-2014"
<< "<br>Christophe Geuzaine and Patrick Dular, University of Li&egrave;ge"
<< "<p><a href=\"http://geuz.org/getdp/doc/CREDITS.txt\">Credits</a> "
<< "and <a href=\"http://geuz.org/getdp/doc/LICENSE.txt\">licensing "
<< "information</a>"
<< "<p>Please send all questions and bug reports to "
<< "<a href=\"mailto:getdp@geuz.org\">getdp@geuz.org</a></center>"
<< "<ul>"
<< "<li><i>Build OS:</i> " << GETDP_OS
<< "<li><i>Build date:</i> " << GETDP_DATE
<< "<li><i>Build options:</i>" << GETDP_CONFIG_OPTIONS
<< "</ul>"
<< "<center>Visit <a href=\"http://geuz.org/getdp/\">http://geuz.org/getdp/</a> "
<< "for more information</center>";
return env->NewStringUTF(sstream.str().c_str());
}
}
......@@ -169,6 +169,22 @@ JNIEXPORT jint JNICALL Java_org_geuz_onelab_Gmsh_animationPrev
JNIEXPORT void JNICALL Java_org_geuz_onelab_Gmsh_setAnimation
(JNIEnv *, jobject, jint);
/*
* Class: org_geuz_onelab_Gmsh
* Method: getAboutGmsh
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jstring JNICALL Java_org_geuz_onelab_Gmsh_getAboutGmsh
(JNIEnv *, jclass);
/*
* Class: org_geuz_onelab_Gmsh
* Method: getAboutGetDP
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jstring JNICALL Java_org_geuz_onelab_Gmsh_getAboutGetDP
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment