summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/source/src/java/org/libreoffice/LOKitThread.java2
-rw-r--r--android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java37
-rw-r--r--android/source/src/java/org/libreoffice/ToolbarController.java6
3 files changed, 19 insertions, 26 deletions
diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java
index c20365d58fad..a3c6733ad81f 100644
--- a/android/source/src/java/org/libreoffice/LOKitThread.java
+++ b/android/source/src/java/org/libreoffice/LOKitThread.java
@@ -265,7 +265,7 @@ class LOKitThread extends Thread {
refresh();
LOKitShell.hideProgressSpinner(mContext);
- mTileProvider.saveDocumentAs(filePath, false);
+ mTileProvider.saveDocumentAs(filePath, true);
} else {
closeDocument();
}
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 210b2bf2ffd5..b9896c3c046c 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -179,17 +179,16 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
// create TextCursorLayer
mDocumentOverlay = new DocumentOverlay(this, layerView);
- // New document type string is not null, meaning we want to open a new document
+ mbISReadOnlyMode = !isExperimentalMode();
+
if (getIntent().getStringExtra(LibreOfficeUIActivity.NEW_DOC_TYPE_KEY) != null) {
+ // New document type string is not null, meaning we want to open a new document
String newDocumentType = getIntent().getStringExtra(LibreOfficeUIActivity.NEW_DOC_TYPE_KEY);
String newFilePath = getIntent().getStringExtra(LibreOfficeUIActivity.NEW_FILE_PATH_KEY);
// Load the new document
loadNewDocument(newFilePath, newDocumentType);
- }
-
- mbISReadOnlyMode = !isExperimentalMode();
- if (getIntent().getData() != null) {
+ } else if (getIntent().getData() != null) {
if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
if (copyFileToTemp() && mTempFile != null) {
mInputFile = mTempFile;
@@ -218,9 +217,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
"org.libreoffice.document_uri");
}
} else {
- if (!isNewDocument) {
- mInputFile = new File(DEFAULT_DOC_PATH);
- }
+ mInputFile = new File(DEFAULT_DOC_PATH);
}
mDrawerLayout = findViewById(R.id.drawer_layout);
@@ -362,13 +359,6 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
}
/**
- * Save a new document
- * */
- public void saveAs(){
- LOKitShell.sendSaveCopyAsEvent(mInputFile.getPath(), FileUtilities.getExtension(mInputFile.getPath()).substring(1));
- }
-
- /**
* Save the document and invoke save on document provider to upload the file
* to the cloud if necessary.
*/
@@ -387,6 +377,17 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
if (documentUri != null) {
// case where file was opened using IDocumentProvider from within LO app
saveFilesToCloud();
+ } else if (isNewDocument) {
+ // nothing to do for actual save, the actual (local) file is already handled
+ // by LOKitTileProvider
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(LibreOfficeMainActivity.this, R.string.message_saved,
+ Toast.LENGTH_SHORT).show();
+ }
+ });
+ setDocumentChanged(false);
} else {
// case where file was passed via Intent
if (isReadOnlyMode() || mInputFile == null || getIntent().getData() == null || !getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT))
@@ -551,11 +552,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
public void onClick(DialogInterface dialog, int which) {
switch (which){
case DialogInterface.BUTTON_POSITIVE:
- if (isNewDocument) {
- saveAs();
- } else {
- mTileProvider.saveDocument();
- }
+ mTileProvider.saveDocument();
isDocumentChanged=false;
onBackPressed();
break;
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index 76c67a06375f..308bc9e6b254 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -172,11 +172,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
mContext.showAbout();
return true;
case R.id.action_save:
- if (mContext.isNewDocument) {
- mContext.saveAs();
- } else {
- mContext.getTileProvider().saveDocument();
- }
+ mContext.getTileProvider().saveDocument();
return true;
case R.id.action_parts:
mContext.openDrawer();