Skip to content

Commit

Permalink
nuovo update site TH-DEMIAN e android app TH-PARADISI
Browse files Browse the repository at this point in the history
  • Loading branch information
robertacalegari committed Mar 22, 2018
1 parent 0b9260b commit 9e71adf
Show file tree
Hide file tree
Showing 1,539 changed files with 1,031 additions and 37,125 deletions.
1 change: 1 addition & 0 deletions 2p-android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
136 changes: 136 additions & 0 deletions 2p-android/app.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="tuPrologMobile2" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="com.android.support:recyclerview-v7-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:support-media-compat-26.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-vector-drawable-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:support-v4-26.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="junit:junit:4.12@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-fragment-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:appcompat-v7-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:animated-vector-drawable-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:transition-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:support-core-utils-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:support-core-ui-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:design-26.0.2" level="project" />
<orderEntry type="library" name="com.android.support:support-compat-26.0.2" level="project" />
<orderEntry type="library" name="__local_aars__:C.\Users\Lucrezia\Documents\ProgettoTesi\tuPrologMobile2\app\libs\tuprolog.jar:unspecified@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-annotations:26.0.2@jar" level="project" />
<orderEntry type="library" name="android-android-26" level="project" />
</component>
</module>
28 changes: 28 additions & 0 deletions 2p-android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
applicationId "alice.tuprologx.android.tuprologmobile"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile fileTree(include: '*.jar', dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added 2p-android/release/app-release.apk
Binary file not shown.
1 change: 1 addition & 0 deletions 2p-android/release/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"alice.tuprologx.android.tuprologmobile","split":"","minSdkVersion":"15"}}]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.Toast;

import java.util.ArrayList;

import alice.tuprologx.android.tuprologmobile.adapters.NavigationDrawerListAdapter;
Expand All @@ -42,6 +44,8 @@ public class BaseActivity extends Activity {

private ActionBarDrawerToggle actionBarDrawerToggle;

private boolean theorySelected = false;
private static final int ACTIVITY_SELECT = 2;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -128,7 +132,9 @@ public void onDrawerStateChanged(int newState) {
}
}


public void setBoolTheory() {
theorySelected = true;
}

protected void openActivity(int position) {

Expand All @@ -145,10 +151,16 @@ protected void openActivity(int position) {
startActivity(new Intent(this, LibraryManagerActivity.class));
break;
case 3: //Set a Theory
startActivity(new Intent(this, TheoriesDatabaseActivity.class));
startActivityForResult(new Intent(this, TheoriesDatabaseActivity.class), ACTIVITY_SELECT);
break;
case 4: //Solve a Query
startActivity(new Intent(this, tuPrologActivity.class));
if(theorySelected) {
startActivity(new Intent(this, tuPrologActivity.class));
}else {
Intent intent = new Intent(this,HomeActivity.class);
intent.putExtra("setTheory", true);
startActivity(intent);
}
break;
case 5: //History
startActivity(new Intent(this, HistoryActivity.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ public void onClick(View v) {
@Override
public void boot() {

String theory = engine.getTheory().toString();
if (theory.equals("")) {
textView.setText("No Theory file selected.");
} else {
textView.setText("Selected Theory : " + theory);
}
// String theory = engine.getTheory().toString();
// if (theory.equals("")) {
// textView.setText("No Theory file selected.");
// } else {
// textView.setText("Selected Theory : " + theory);
// }
try {
solution.setText("tuProlog "
+ tuPrologActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ protected void onCreate(Bundle savedInstanceState) {
if(getIntent().getBooleanExtra("finishApplication", false)){
closeApplication();
}
if(getIntent().getBooleanExtra("setTheory", false)) {
Toast.makeText(context, "Select a theory first! ",
Toast.LENGTH_SHORT).show();
}

CUIConsole.main2();

Expand Down Expand Up @@ -150,8 +154,17 @@ public void onClick(View v) {
@Override
public void onClick(View v) {

Intent libraryIntent = new Intent(HomeActivity.this, tuPrologActivity.class);
startActivity(libraryIntent);
if(theorySelect){

Intent libraryIntent = new Intent(HomeActivity.this, tuPrologActivity.class);
libraryIntent.putExtra("theory", t);
libraryIntent.putExtra("nameTheory", nameTheory);
startActivity(libraryIntent);
} else {
Toast.makeText(context, "Select a theory first! ",
Toast.LENGTH_SHORT).show();
}


}
});
Expand All @@ -165,7 +178,13 @@ public void onClick(View v) {
alert.setTitle("Info Theory");
alert.setMessage("In this section you can customize the mobile engine" + "\n\n" +
"Example Prolog Theory:\n" +
"INSERIRE ESEMPIO!!!" );
"man(Andrea).\n" +
"man(Marco).\n" +
"woman(Elisa).\n" +
"parent(Andrea, Marco).\n" +
"parent(Elisa, Marco). \n" +
"father(F,C) :- man(F), parent(F,C).\n" +
"mother(M,C) :- woman(M), parent(M,C).\n" );

alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Expand All @@ -186,7 +205,8 @@ public void onClick(View v) {
alert.setTitle("Info Query");
alert.setMessage("In this section you can solve queries" + "\n\n" +
"Example Prolog Query:\n" +
"INSERIRE ESEMPIO!!!" );
"?- father(F, Marco) \n" +
"?- mother(M, Marco) \n");

alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Expand All @@ -208,12 +228,18 @@ public void onBackPressed() {
closeApplication();
}

private Bundle extras = null;
private boolean theorySelect = false;
private Theory t;
private String nameTheory = "";

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_OK) {
Bundle extras = intent.getExtras();

extras = intent.getExtras();
theorySelect = true;
setBoolTheory();
switch (requestCode) {
case THEORY_SELECT:
Long id = extras.getLong(TheoryDbAdapter.KEY_ROWID);
Expand All @@ -223,14 +249,15 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
Theory oldTheory = CUIConsole.engine.getTheory();

try {
Theory t;
// Theory t;
t = new Theory(theoryCursor.getString(theoryCursor
.getColumnIndexOrThrow(TheoryDbAdapter.KEY_BODY))
+ System.getProperty("line.separator"));
CUIConsole.engine.setTheory(t);
nameTheory = theoryCursor.getString(theoryCursor.getColumnIndexOrThrow(TheoryDbAdapter.KEY_TITLE));
tvTheorySelected.setText("Selected Theory : "
+ theoryCursor.getString(theoryCursor
.getColumnIndexOrThrow(TheoryDbAdapter.KEY_TITLE)));
+ nameTheory );

Toast.makeText(
context,
"Theory selected: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private void saveState() {
String body = mBodyText.getText().toString();

if (mRowId == null && !title.equals("")) {
title = title + ".txt";
long id = mDbHelper.createTheory(title, body);
if(prefs.getBoolean("swSaveT",false)==true)
mHDbHelper.createTheory(title, body);
Expand Down
Loading

0 comments on commit 9e71adf

Please sign in to comment.