diff --git a/docs-android/app/app.iml b/docs-android/app/app.iml
index 11564944..999cb6ee 100644
--- a/docs-android/app/app.iml
+++ b/docs-android/app/app.iml
@@ -101,15 +101,15 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/docs-android/app/build.gradle b/docs-android/app/build.gradle
index 3f7040d8..e1f591d4 100644
--- a/docs-android/app/build.gradle
+++ b/docs-android/app/build.gradle
@@ -35,7 +35,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
- compile 'com.android.support:appcompat-v7:22.0.0'
+ compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java
index 36cac205..56cde065 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java
@@ -3,7 +3,7 @@ package com.sismics.docs.activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -43,7 +43,7 @@ import de.greenrobot.event.EventBus;
*
* @author bgamard.
*/
-public class DocumentEditActivity extends ActionBarActivity {
+public class DocumentEditActivity extends AppCompatActivity {
/**
* Document edited.
*/
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentViewActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentViewActivity.java
index 305e363c..6b982c6d 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentViewActivity.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentViewActivity.java
@@ -13,7 +13,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.ViewPager;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.text.format.DateFormat;
@@ -57,7 +57,7 @@ import de.greenrobot.event.EventBus;
*
* @author bgamard
*/
-public class DocumentViewActivity extends ActionBarActivity {
+public class DocumentViewActivity extends AppCompatActivity {
/**
* Request code of adding file.
*/
@@ -116,8 +116,10 @@ public class DocumentViewActivity extends ActionBarActivity {
// Setup the activity
setContentView(R.layout.document_view_activity);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setHomeButtonEnabled(true);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
+ }
// Fill the view
refreshDocument(document);
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/LoginActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/LoginActivity.java
index 27ff193b..dc10323b 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/activity/LoginActivity.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/LoginActivity.java
@@ -3,7 +3,7 @@ package com.sismics.docs.activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.View;
@@ -30,7 +30,7 @@ import org.json.JSONObject;
*
* @author bgamard
*/
-public class LoginActivity extends ActionBarActivity {
+public class LoginActivity extends AppCompatActivity {
/**
* User interface.
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/MainActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/MainActivity.java
index fd8a8aba..b013f29b 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/activity/MainActivity.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/MainActivity.java
@@ -7,8 +7,8 @@ import android.content.res.Configuration;
import android.os.Bundle;
import android.provider.SearchRecentSuggestions;
import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuInflater;
@@ -39,7 +39,8 @@ import de.greenrobot.event.EventBus;
*
* @author bgamard
*/
-public class MainActivity extends ActionBarActivity {
+
+public class MainActivity extends AppCompatActivity {
private ActionBarDrawerToggle drawerToggle;
private MenuItem searchItem;
@@ -61,8 +62,10 @@ public class MainActivity extends ActionBarActivity {
// Enable ActionBar app icon to behave as action to toggle nav drawer
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setHomeButtonEnabled(true);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
+ }
// ActionBarDrawerToggle ties together the the proper interactions
// between the sliding drawer and the action bar app icon
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/SettingsActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/SettingsActivity.java
index 510c3489..176e8120 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/activity/SettingsActivity.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/SettingsActivity.java
@@ -1,7 +1,7 @@
package com.sismics.docs.activity;
import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import com.sismics.docs.fragment.SettingsFragment;
@@ -11,14 +11,16 @@ import com.sismics.docs.fragment.SettingsFragment;
*
* @author bgamard.
*/
-public class SettingsActivity extends ActionBarActivity {
+public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setHomeButtonEnabled(true);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
+ }
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
diff --git a/docs-core/src/main/java/com/sismics/docs/core/listener/async/FileCreatedAsyncListener.java b/docs-core/src/main/java/com/sismics/docs/core/listener/async/FileCreatedAsyncListener.java
index be688334..1b76cb0d 100644
--- a/docs-core/src/main/java/com/sismics/docs/core/listener/async/FileCreatedAsyncListener.java
+++ b/docs-core/src/main/java/com/sismics/docs/core/listener/async/FileCreatedAsyncListener.java
@@ -48,6 +48,11 @@ public class FileCreatedAsyncListener {
@Override
public void run() {
FileDao fileDao = new FileDao();
+ if (fileDao.getById(file.getId()) == null) {
+ // The file has been deleted since the OCR-ization started, ignore the result
+ return;
+ }
+
file.setContent(content);
fileDao.update(file);
}
diff --git a/docs-web/src/main/webapp/src/app/docs/controller/Document.js b/docs-web/src/main/webapp/src/app/docs/controller/Document.js
index 4c15e862..6af0d944 100644
--- a/docs-web/src/main/webapp/src/app/docs/controller/Document.js
+++ b/docs-web/src/main/webapp/src/app/docs/controller/Document.js
@@ -95,20 +95,6 @@ angular.module('docs').controller('Document', function($scope, $timeout, $state,
$scope.loadDocuments();
});
- /**
- * Go to add document form.
- */
- $scope.addDocument = function() {
- $state.transitionTo('document.add');
- };
-
- /**
- * Go to edit document form.
- */
- $scope.editDocument = function(id) {
- $state.transitionTo('document.edit', { id: id });
- };
-
/**
* Display a document.
*/
diff --git a/docs-web/src/main/webapp/src/partial/docs/document.html b/docs-web/src/main/webapp/src/partial/docs/document.html
index 66647a32..1d773b59 100644
--- a/docs-web/src/main/webapp/src/partial/docs/document.html
+++ b/docs-web/src/main/webapp/src/partial/docs/document.html
@@ -2,7 +2,7 @@