...
 
Commits (3)
/build
src/main/libs
src/main/obj
src/main/assets/calcvac/vacline/vacline.armeabi
src/main/assets/calcvac/vacline/vacline.armeabi-v7a
src/main/assets/calcvac/vacline/vacline.x86
......@@ -3,6 +3,8 @@
echo "compiling native libs"
$ANDROID_NDK_HOME/ndk-build -C $3
mkdir -p $2/calcvac/vacline
echo "moving binaries from libs to assets"
echo $1/armeabi/vacline "-->" $2/calcvac/vacline/vacline.armeabi
cp -a $1/armeabi/vacline $2/calcvac/vacline/vacline.armeabi
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Calcvac for Android (c) 2002-2018 Markus Hoffmann
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.drhoffmannsoftware.calcvac"
android:versionCode="1"
android:versionName="2.01-1"
>
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/>
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/calcvaclogo"
android:label="@string/app_name"
android:roundIcon="@drawable/calcvaclogo">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".InfoActivity" />
<activity android:name=".PreferencesActivity" />
<activity android:name=".TabletoolActivity" />
<activity android:name=".PlottoolActivity" />
<activity android:name=".CalibrationActivity" />
<activity android:name=".ComponentEditorActivity" />
<activity android:name=".LineEditorActivity" />
<activity android:name=".ElementEditorActivity" />
<activity android:name=".LeitwerteCalculatorActivity" />
<activity android:name=".LinkEditorActivity" />
<activity android:name=".PumpEditorActivity" />
<activity android:name=".MaterialEditorActivity" />
<activity android:name=".MolChooserActivity" />
</application>
</manifest>
package de.drhoffmannsoftware.calcvac;
/* CalibrationActivity.java (c) 2018 by Markus Hoffmann
*
* This file is part of Calcvac for Android, (c) by Markus Hoffmann 2002-2018
* ==========================================================================
* Calcvac for Android is free software and comes with
* NO WARRANTY - read the file COPYING for details.
*/
import android.app.ActionBar;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.MenuItem;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
public class CalibrationActivity extends Activity {
private CheckBox histograms,grid,label,links,lattice;
private CheckBox fixscale1,fixscale2,fixscale3;
private EditText minscale1, maxscale1, stepscale1;
private EditText minscale2, maxscale2, stepscale2;
private RadioButton bt1,bt2,bt3,bt5;
private SharedPreferences settings;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.calibration);
ActionBar actionBar = getActionBar();
// actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.plot_clibration_settings);
histograms=findViewById(R.id.checkBox_histogram);
grid=findViewById(R.id.checkBox_grid);
label=findViewById(R.id.checkBox_label);
links= findViewById(R.id.checkBox_links);
lattice= findViewById(R.id.checkBox_lattice);
fixscale1=findViewById(R.id.fixscale1);
fixscale2=findViewById(R.id.fixscale2);
fixscale3=findViewById(R.id.fixscale3);
bt1=findViewById(R.id.bt1);
bt2=findViewById(R.id.bt2);
bt3=findViewById(R.id.bt3);
bt5=findViewById(R.id.bt5);
minscale1=findViewById(R.id.minscale1);
minscale2=findViewById(R.id.minscale2);
maxscale1=findViewById(R.id.maxscale1);
maxscale2=findViewById(R.id.maxscale2);
stepscale1=findViewById(R.id.stepscale1);
stepscale2=findViewById(R.id.stepscale2);
settings =PreferenceManager.getDefaultSharedPreferences(getBaseContext());
}
@Override
public void onResume() {
super.onResume();
histograms.setChecked(settings.getBoolean("histograms", false));
grid.setChecked(settings.getBoolean("grid", true));
label.setChecked(settings.getBoolean("label", false));
links.setChecked(settings.getBoolean("links", true));
lattice.setChecked(settings.getBoolean("lattice", true));
fixscale1.setChecked(settings.getBoolean("fixscale1", false));
fixscale2.setChecked(settings.getBoolean("fixscale2", false));
fixscale3.setChecked(settings.getBoolean("fixscale3", false));
bt1.setChecked(settings.getInt("bluecurvetype", 1)==1);
bt2.setChecked(settings.getInt("bluecurvetype", 1)==2);
bt3.setChecked(settings.getInt("bluecurvetype", 1)==3);
bt5.setChecked(settings.getInt("bluecurvetype", 1)==5);
minscale1.setText(""+settings.getFloat("minscale1", (float)0.0));
minscale2.setText(""+settings.getFloat("minscale2", (float)0.0));
maxscale1.setText(""+settings.getFloat("maxscale1", (float)100.0));
maxscale2.setText(""+settings.getFloat("maxscale2", (float)100.0));
stepscale1.setText(""+settings.getFloat("stepscale1", (float)1.0));
stepscale2.setText(""+settings.getFloat("stepscale2", (float)1.0));
}
@Override
protected void onPause(){
int bluecurvetype=0;
super.onPause();
// We need an Editor object to make preference changes.
// All objects are from android.context.Context
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("histograms", histograms.isChecked());
editor.putBoolean("grid", grid.isChecked());
editor.putBoolean("label", label.isChecked());
editor.putBoolean("links", links.isChecked());
editor.putBoolean("lattice", lattice.isChecked());
editor.putBoolean("fixscale1", fixscale1.isChecked());
editor.putBoolean("fixscale2", fixscale2.isChecked());
editor.putBoolean("fixscale3", fixscale3.isChecked());
if(bt1.isChecked()) bluecurvetype=1;
else if(bt2.isChecked()) bluecurvetype=2;
else if(bt3.isChecked()) bluecurvetype=3;
else if(bt5.isChecked()) bluecurvetype=5;
editor.putInt("bluecurvetype",bluecurvetype );
editor.putFloat("minscale1",(float)Double.parseDouble(minscale1.getText().toString()));
editor.putFloat("maxscale1",(float)Double.parseDouble(maxscale1.getText().toString()));
editor.putFloat("stepscale1",(float)Double.parseDouble(stepscale1.getText().toString()));
editor.putFloat("minscale2",(float)Double.parseDouble(minscale2.getText().toString()));
editor.putFloat("maxscale2",(float)Double.parseDouble(maxscale2.getText().toString()));
editor.putFloat("stepscale2",(float)Double.parseDouble(stepscale2.getText().toString()));
// Commit the edits!
editor.apply();
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
package de.drhoffmannsoftware.calcvac;
/* Help.java (c) 2011-2018 by Markus Hoffmann
*
* This file is part of Calcvac for Android, (c) by Markus Hoffmann 2002-2018
* ==========================================================================
* Calcvac for Android is free software and comes with
* NO WARRANTY - read the file COPYING for details.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Locale;
import android.content.res.AssetManager;
import android.util.Log;
public class Help {
private final static String TAG="Help";
/*Get something useful in html from manual in asset folder */
public static String getonlinehelp(AssetManager assetManager, String key) {
String t="sorry, nothing found.";
key=key.toUpperCase(Locale.US);
String[] files;
try { files = assetManager.list("manual"); } catch (IOException e) {return("ERROR:"+e.toString());}
for(String filename : files) {
if(filename.charAt(0)==key.charAt(0) && filename.endsWith(".sec")) {
InputStream in = null;
try {
in = assetManager.open("manual"+"/"+filename);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line, results = "";
boolean flag=false,pre=false;
while( ( line = reader.readLine() ) != null) {
line=line.replace("&","&amp;");
line=line.replace("\"","&quot;");
line=line.replace("\\$","$");
line=line.replace("<","&lt;");
line=line.replace(">","&gt;");
if((line.startsWith("Command:") && line.contains(key)) ||
(line.startsWith("Function:") && line.contains(key)) ||
(line.startsWith("Operator:") && line.contains(key)) ||
(line.startsWith("Variable:") && line.contains(key))
) flag=true;
if(flag && (line.startsWith("EXAMPLE:") || line.startsWith("EXAMPLES:") )) {
pre=true;
results += line+"\n<pre>";
} else if(flag && line.startsWith("#####")) {
flag=false;
if(pre) results += "</pre>\n";
pre=false;
results += "<hr>"+"\n";
} else if(flag) results += line+"\n";
}
reader.close();
if(pre) results += "</pre>\n";
in.close();
in = null;
t=results;
} catch(Exception e) {Log.e(TAG, e.toString());}
}
}
t=t.replace("\n", "<br>");
t=t.replace("\\hline", "<hr>");
return t;
}
/* Get release notes from file in assets and convert it to html*/
public static String getreleasenotes(AssetManager assetManager) {
String t="sorry, nothing found.";
final String filename="RELEASE_NOTES";
InputStream in = null;
try {
in = assetManager.open("manual"+"/"+filename);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line, results = "";
while( ( line = reader.readLine() ) != null) {
line=line.replace("&","&amp;");
line=line.replace("\"","&quot;");
line=line.replace("\\$","$");
line=line.replace("<","&lt;");
line=line.replace(">","&gt;");
results += line+"\n";
}
reader.close();
in.close();
in = null;
t=results;
} catch(Exception e) {Log.e(TAG, e.toString());}
t=t.replace("\n", "<br>");
t=t.replace("\\hline", "<hr>");
return t;
}
}
package de.drhoffmannsoftware.calcvac;
/* InfoActivity.java (c) 2018 by Markus Hoffmann
*
* This file is part of Calcvac for Android, (c) by Markus Hoffmann 2002-2018
* ==========================================================================
* Calcvac for Android is free software and comes with
* NO WARRANTY - read the file COPYING for details.
*/
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Button;
public class InfoActivity extends MainActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.info);
Button fertig=findViewById(R.id.okbutton);
TextView readme=findViewById(R.id.description);
readme.setText(Html.fromHtml(getResources().getString(R.string.description)+getResources().getString(R.string.readme)+
getResources().getString(R.string.news)+getResources().getString(R.string.impressum)
));
fertig.setOnClickListener(new OnClickListener() {
public void onClick(View v) {finish();}
});
}
}
package de.drhoffmannsoftware.calcvac;
/* MolChooserActivity.java (c) 2018 by Markus Hoffmann
*
* This file is part of Calcvac for Android, (c) by Markus Hoffmann 2002-2018
* ==========================================================================
* Calcvac for Android is free software and comes with
* NO WARRANTY - read the file COPYING for details.
*/
import android.app.ActionBar;
import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import java.util.ArrayList;
public class MolChooserActivity extends Activity {
LinearLayout checkboxes;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.molecule);
ActionBar actionBar = getActionBar();
// actionBar.setHomeButtonEnabled(true);
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.molecule_mass_chooser);
}
checkboxes=findViewById(R.id.checkBoxes);
}
@Override
public void onStart() {
super.onStart();
ArrayList<Integer> moi=VacFile.mols_of_interest;
checkboxes.removeAllViews();
CheckBox cb;
int i;
for(i=0;i<Gas.moles.length;i++) {
if(Gas.moles[i].length()>0) {
cb = new CheckBox(this);
cb.setText(Gas.moles[i]);
if (i == 0) {
cb.setChecked(true);
cb.setEnabled(false);
} else if(moi.contains(i)) {
cb.setChecked(true);
}
checkboxes.addView(cb);
}
}
}
@Override
protected void onStop(){
super.onStop();
String t;
String a[];
int idx;
int i=checkboxes.getChildCount();
VacFile.mols_of_interest.clear();
while(--i>=0) {
t=((CheckBox)checkboxes.getChildAt(i)).getText().toString();
a=t.split(" ",2);
if(!a[0].isEmpty()) {
idx = Integer.parseInt(a[0]);
if(((CheckBox)checkboxes.getChildAt(i)).isChecked()) {
VacFile.mols_of_interest.add(idx);
}
}
}
}
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.moleculemenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
finish();
return true;
case R.id.mc_options_help:
showDialog(9);
return true;
}
return true;
}
@Override
protected Dialog onCreateDialog(final int id) {
Dialog dialog = null;
if(id==9) {
dialog = Tools.scrollableDialog(this, "Info", getResources().getString(R.string.moleculehelpdialog));
}
return dialog;
}
}
This diff is collapsed.
package de.drhoffmannsoftware.calcvac;
/* PlottoolActivity.java (c) 2018 by Markus Hoffmann
*
* This file is part of Calcvac for Android, (c) by Markus Hoffmann 2002-2018
* ==========================================================================
* Calcvac for Android is free software and comes with
* NO WARRANTY - read the file COPYING for details.
*/
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class PlottoolActivity extends Activity {
private PlotView plot;
private static final String TAG = "CALCVAC Plottool";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.plottool);
plot= findViewById(R.id.mainplot);
plot.setTimeX(false);
TextView testTextView = findViewById(R.id.dummyTextView);
float textSize = testTextView.getTextSize();
plot.setTextsize(textSize);
plot.setData(MainActivity.data);
plot.setAutoRangeX();
plot.setAutoGridX();
plot.setAutoRangeY1();
plot.setAutoGridY1();
plot.setAutoRangeY2();
plot.setAutoGridY2();
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(getResources().getString(R.string.word_plottooltitle));
}
}
@Override
public void onStart() {
super.onStart();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
plot.setHistEnable(prefs.getBoolean("histograms", false));
plot.setGridEnable(prefs.getBoolean("grid", true));
plot.setEventEnable(prefs.getBoolean("event", false));
plot.setLabelEnable(prefs.getBoolean("label", false));
plot.setLinksEnable(prefs.getBoolean("links", true));
plot.setLatticeEnable(prefs.getBoolean("lattice", true));
}
// @Override
// public void onResume() {
// super.onResume();
// }
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.plottoolmenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This is called when the Home (Up) button is pressed
// in the Action Bar.
finish();
return true;
case R.id.vdl_options_preferences:
startActivity(new Intent(this, PreferencesActivity.class));
return true;
case R.id.vdl_options_about:
showDialog(0);
return true;
case R.id.vdl_options_calibration:
startActivity(new Intent(this, CalibrationActivity.class));
return true;
case R.id.vdl_options_help:
showDialog(1);
return true;
case R.id.vdl_options_finish:
finish();
return true;
case R.id.menu_savebitmap:
savebitmap();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
protected Dialog onCreateDialog(final int id) {
Dialog dialog = null;
if(id==1) {
dialog = Tools.scrollableDialog(this,"",getResources().getString(R.string.plottoolhelpdialog));
} else if(id==0) {
dialog = Tools.scrollableDialog(this,"",getResources().getString(R.string.description)+
getResources().getString(R.string.impressum));
}
return dialog;
}
private void updatePlot(DataContent data) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
boolean fix1=prefs.getBoolean("fixscale1", false);
float minscale1=prefs.getFloat("minscale1", 0);
float maxscale1=prefs.getFloat("maxscale1", 0);
float stepscale1=prefs.getFloat("stepscale1", 0);
boolean fix2=prefs.getBoolean("fixscale2", false);
float minscale2=prefs.getFloat("minscale2", 0);
float maxscale2=prefs.getFloat("maxscale2", 0);
float stepscale2=prefs.getFloat("stepscale2", 0);
plot.setData(data);
plot.setAutoRangeX();
if(fix1) plot.setY1Range(minscale1,maxscale1);
else plot.setAutoRangeY1();
if(fix2) plot.setY2Range(minscale2,maxscale2);
else plot.setAutoRangeY2();
plot.setAutoGridX();
if(fix1) plot.setYGrid(stepscale1);
else plot.setAutoGridY1();
if(fix2) plot.setY2Grid(stepscale2);
else plot.setAutoGridY2();
plot.postInvalidate();
}
public void savebitmap() {
FileOutputStream fos=null;
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd-HHmmss",Locale.US);
String filename="Diagram-"+sdf.format(date)+".png";
Bitmap bmp;
try {
/* Hier jetzt ein externe von aussen lesbares verzeichnis*/
File dirdata=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
dirdata.mkdirs();
File file=new File(dirdata,filename);
fos=new FileOutputStream(file,false);
bmp=View2Bitmap(plot);
bmp.compress(Bitmap.CompressFormat.PNG, 90, fos);
fos.flush();
Toast.makeText(getApplicationContext(), String.format("File %s saved.",file.getAbsolutePath()), Toast.LENGTH_LONG).show();
} catch (Throwable t) {
// FilenotFound oder IOException
Log.e(TAG,"open/save. ",t);
} finally {
if(fos!=null) {
try {
fos.close();
} catch (IOException e) {
Log.e(TAG,"fos.close ",e);
}
}
}
}
public static Bitmap View2Bitmap(View v) {
Log.d(TAG,"width="+v.getLayoutParams().width);
v.setDrawingCacheEnabled(true);
Bitmap b= v.getDrawingCache();
Canvas c = new Canvas(b);
v.draw(c);
return b;
}
}
package de.drhoffmannsoftware.calcvac;
/* PreferencesActivity.java (c) 2018 by Markus Hoffmann
*
* This file is part of Calcvac for Android, (c) by Markus Hoffmann 2002-2018
* ==========================================================================
* Calcvac for Android is free software and comes with
* NO WARRANTY - read the file COPYING for details.
*/
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
public class PreferencesActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener{
private final static String HOMEPAGE="https://gitlab.com/kollo/Calcvac-Android";
private final static String WIKI_PAGE="https://gitlab.com/kollo/Calcvac-Android/wikis/home";
private final static String FORUM_PAGE="https://gitlab.com/kollo/Calcvac-Android/issues";
private final static String ISSUES_PAGE="https://gitlab.com/kollo/Calcvac-Android/issues";
private final static String EXAMPLES_PAGE="https://gitlab.com/kollo/Calcvac_examples";
private final static String MANUAL_PAGE="https://gitlab.com/kollo/Calcvac-Android/raw/master/doc/User-Manual/Calcvac-manual-2.01.pdf";
private final static String LICENSE_PAGE="https://gitlab.com/kollo/Calcvac-Android/raw/master/LICENSE";
private final static String SOURCE_PAGE="https://gitlab.com/kollo/Calcvac-Android";
private final static String HERA_03_23="http://www-library.desy.de/ahluwali/herareports/2003/HERA-03-23.pdf";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
// PreferenceManager.setDefaultValues(Preferences.this, R.xml.preferences, false);
findPreference("about_version").setSummary(applicationVersion());
findPreference("about_homepage").setSummary(HOMEPAGE);
findPreference("about_guestbook").setSummary(ISSUES_PAGE);
// findPreference("about_wiki").setSummary(WIKI_PAGE);
findPreference("about_forum").setSummary(FORUM_PAGE);
findPreference("about_example_programs").setSummary(EXAMPLES_PAGE);
findPreference("about_manual").setSummary(MANUAL_PAGE);
findPreference("about_herareport").setSummary(HERA_03_23);
// findPreference("about_license").setSummary(Constants.LICENSE_URL);
// findPreference("about_source").setSummary(Constants.SOURCE_URL);
// findPreference("about_market_app").setSummary(String.format("market://details?id=%s", getPackageName()));
// findPreference("about_market_publisher").setSummary("market://search?q=pub:\"Markus Hoffmann\"");
// Get a reference to the preferences
// mCheckBoxPreference = (CheckBoxPreference)getPreferenceScreen().findPreference(KEY_ADVANCED_CHECKBOX_PREFERENCE);
// mListPreference = (ListPreference)getPreferenceScreen().findPreference("select_fileformat");
for(int i=0;i<getPreferenceScreen().getPreferenceCount();i++) {
initSummary(getPreferenceScreen().getPreference(i));
}
}
@Override
protected void onResume() {
super.onResume();
// Set up a listener whenever a key changes
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onPause() {
super.onPause();
// Unregister the listener whenever a key changes
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
updatePrefSummary(findPreference(key));
MainActivity.nplot=(int)(Math.max(32,Double.parseDouble(sharedPreferences.getString("prefs_numpoints", "3072"))));
MainActivity.resolution=(Double.parseDouble(sharedPreferences.getString("prefs_resolution", "0.001")));
if(MainActivity.resolution<=0) MainActivity.resolution=0.001;
}
private void initSummary(Preference p) {
if(p instanceof PreferenceCategory) {
PreferenceCategory pCat = (PreferenceCategory) p;
for(int i=0;i<pCat.getPreferenceCount();i++) {
initSummary(pCat.getPreference(i));
}
} else updatePrefSummary(p);
}
private void updatePrefSummary(Preference p){
if (p instanceof ListPreference) {
ListPreference listPref = (ListPreference) p;
p.setSummary(listPref.getEntry());
}
if (p instanceof EditTextPreference) {
EditTextPreference editTextPref = (EditTextPreference) p;
p.setSummary(editTextPref.getText());
}
}
private String applicationVersion() {
try {return getPackageManager().getPackageInfo(getPackageName(), 0).versionName;}
catch (NameNotFoundException x) { return "unknown"; }
}
@Override
public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen, final Preference preference) {
final String key = preference.getKey();
if("about_license".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(LICENSE_PAGE)));
finish();
} else if ("about_version".equals(key)) {
startActivity(new Intent(this, InfoActivity.class));
} else if ("about_example_programs".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(EXAMPLES_PAGE)));
finish();
} else if ("about_source".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(SOURCE_PAGE)));
finish();
} else if ("about_homepage".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(HOMEPAGE)));
finish();
} else if ("about_guestbook".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(ISSUES_PAGE)));
finish();
} else if ("about_wiki".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(WIKI_PAGE)));
finish();
} else if ("about_forum".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(FORUM_PAGE)));
finish();
} else if ("about_manual".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(MANUAL_PAGE)));
finish();
} else if ("about_herareport".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(HERA_03_23)));
finish();
} else if ("about_market_app".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("market://details?id=%s", getPackageName()))));
finish();
} else if ("about_market_publisher".equals(key)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:\"Markus Hoffmann\"")));
finish();
}
return false;
}
}
LOCAL_PATH := $(call my-dir)
export MAINDIR:= $(LOCAL_PATH)
#LAPACK, BLAS, F2C compilation
include $(CLEAR_VARS)
LOCAL_CFLAGS := -fsigned-char
include $(MAINDIR)/clapack/Android.mk
LOCAL_PATH := $(MAINDIR)
include $(CLEAR_VARS)
LOCAL_MODULE:= lapack
LOCAL_STATIC_LIBRARIES := tmglib clapack1 clapack2 clapack3 blas f2c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_EXPORT_LDLIBS := $(LOCAL_LDLIBS)
include $(BUILD_STATIC_LIBRARY)
#vacline binary for assets
include $(CLEAR_VARS)
include $(MAINDIR)/vacline/Android.mk
# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a x86 mips arm64-v8a x86_64 mips64
# APP_ABI := all
APP_PLATFORM := android-11
APP_MODULES := vacline
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := vacline
LOCAL_SRC_FILES := vacline.c utility.c parser.c mathematics.c main.c
LOCAL_CFLAGS := -fsigned-char
LOCAL_LDLIBS := -lm
LOCAL_STATIC_LIBRARIES = lapack
include $(BUILD_EXECUTABLE)
This diff is collapsed.
This diff is collapsed.
/* Erstellt: Jan. 2009 **
*/
/* This file is part of VACLINE, pressure profile calculation
* ============================================================
* VACLINE is scientific software and comes with NO WARRANTY - read the file
* COPYING for details
*/
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
#define SHFT(a,b,c,d) (a)=(b);(b)=(c);(c)=(d);
#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
#define isign(a) ((a>=0)?1:-1)
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a<b)?a:b)
#define TRUE 1
#define FALSE 0
#define SQR(a) ((a)*(a))
#define PI 3.141592653589793
/* Define ANDROID if this should be used with the android f2c lib*/
#define ANDROID 1
typedef struct {
#ifdef ANDROID
long int rows;
long int cols;
#else
int rows;
int cols;
#endif
double *pointer;
} MATRIX;
#define MAT(m,a,b) ((m.pointer)[a+(b)*m.rows])
#ifdef __cplusplus
extern "C" {
#endif
MATRIX create_matrix(int rows,int cols);
void clear_matrix(MATRIX *a);
void free_matrix(MATRIX *a);
MATRIX solve(MATRIX,MATRIX);
MATRIX SVD(MATRIX a, MATRIX *w, MATRIX *v);
MATRIX backsub(MATRIX singulars, MATRIX u, MATRIX v, MATRIX b);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.