[Libreoffice-commits] online.git: 2 commits - android/app android/lib
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 23 10:41:33 UTC 2019
android/app/src/main/AndroidManifest.xml | 6 +--
android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java | 4 +-
android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java | 17 ----------
android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java | 10 ++---
android/app/src/main/res/layout/activity_show_html.xml | 2 -
android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 10 ++---
6 files changed, 17 insertions(+), 32 deletions(-)
New commits:
commit 1d549fa9dd423d91cba23ea10acc2d8a36ef5122
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jul 23 12:38:41 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Jul 23 12:40:09 2019 +0200
android: Obviously we need to request for writing, not only reading.
Change-Id: I68927593bd17a6ee6de0c1d879d6b05372c1350e
diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index 3d6838a12..ce1243348 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -64,7 +64,7 @@ public class LOActivity extends AppCompatActivity {
final static String TAG = "LOActivity";
private static final String ASSETS_EXTRACTED_PREFS_KEY = "ASSETS_EXTRACTED";
- private static final int PERMISSION_READ_EXTERNAL_STORAGE = 777;
+ private static final int PERMISSION_WRITE_EXTERNAL_STORAGE = 777;
private static final String KEY_ENABLE_SHOW_DEBUG_INFO = "ENABLE_SHOW_DEBUG_INFO";
private static final String KEY_PROVIDER_ID = "providerID";
@@ -327,11 +327,11 @@ public class LOActivity extends AppCompatActivity {
}
});
- if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
Log.i(TAG, "asking for read storage permission");
ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
- PERMISSION_READ_EXTERNAL_STORAGE);
+ new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
+ PERMISSION_WRITE_EXTERNAL_STORAGE);
} else {
loadDocument();
}
@@ -352,7 +352,7 @@ public class LOActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
- case PERMISSION_READ_EXTERNAL_STORAGE:
+ case PERMISSION_WRITE_EXTERNAL_STORAGE:
if (permissions.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
loadDocument();
} else {
commit a04ed68104b3091ebac767fdd5f4157596135a87
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jul 23 09:46:04 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Jul 23 12:40:09 2019 +0200
android: No need for the extra wrapper, use the LOActivity directly.
Change-Id: Ie4afaedcc3b255c83c570acea02101d284e85653
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 8a776f3be..ae17c0878 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -23,7 +23,7 @@
android:supportsRtl="true"
android:theme="@style/LibreOfficeTheme">
<!-- SlideShow Activity -->
- <activity android:name=".SlideShowActivity"
+ <activity android:name="org.libreoffice.androidlib.SlideShowActivity"
android:theme="@style/FullScreenStyle"
android:screenOrientation="sensorLandscape"/>
<!-- Document Browser Activity -->
@@ -43,7 +43,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
- <activity android:name=".MainActivity">
+ <activity android:name="org.libreoffice.androidlib.LOActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
@@ -128,4 +128,4 @@
android:theme="@style/Theme.AppCompat.Light" />
</application>
-</manifest>
\ No newline at end of file
+</manifest>
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java b/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java
index 397cde677..d101c2914 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/AboutDialogFragment.java
@@ -25,6 +25,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
+import org.libreoffice.androidlib.LOActivity;
+
public class AboutDialogFragment extends DialogFragment {
private static final String DEFAULT_DOC_PATH = "/assets/example.odt";
@@ -103,7 +105,7 @@ public class AboutDialogFragment extends DialogFragment {
.setNeutralButton(R.string.about_moreinfo, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
- Intent intent = new Intent(getContext(), MainActivity.class);
+ Intent intent = new Intent(getContext(), LOActivity.class);
intent.putExtra("URI", "file:///android_asset/example.odt");
startActivity(intent);
dialog.dismiss();
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
deleted file mode 100644
index 4c75b27c4..000000000
--- a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-package org.libreoffice.androidapp;
-
-import org.libreoffice.androidlib.LOActivity;
-
-public class MainActivity extends LOActivity {
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
index 9e3f87e22..7dfc677a8 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java
@@ -60,7 +60,6 @@ import com.google.android.material.navigation.NavigationView;
import org.libreoffice.androidapp.AboutDialogFragment;
import org.libreoffice.androidapp.LibreOfficeApplication;
import org.libreoffice.androidapp.LocaleHelper;
-import org.libreoffice.androidapp.MainActivity;
import org.libreoffice.androidapp.R;
import org.libreoffice.androidapp.SettingsActivity;
import org.libreoffice.androidapp.SettingsListenerModel;
@@ -68,6 +67,7 @@ import org.libreoffice.androidapp.storage.DocumentProviderFactory;
import org.libreoffice.androidapp.storage.DocumentProviderSettingsActivity;
import org.libreoffice.androidapp.storage.IDocumentProvider;
import org.libreoffice.androidapp.storage.IFile;
+import org.libreoffice.androidlib.LOActivity;
import java.io.File;
import java.io.FileFilter;
@@ -583,10 +583,10 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
String packageName = getApplicationContext().getPackageName();
ComponentName componentName = new ComponentName(packageName,
- MainActivity.class.getName());
+ LOActivity.class.getName());
i.setComponent(componentName);
- // these extras allow to rebuild the IFile object in LOMainActivity
+ // these extras allow to rebuild the IFile object in LOActivity
i.putExtra("org.libreoffice.document_provider_id",
documentProvider.getId());
i.putExtra("org.libreoffice.document_uri",
@@ -626,7 +626,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
Intent i = new Intent(Intent.ACTION_VIEW, newDocUri);
String packageName = getApplicationContext().getPackageName();
- ComponentName componentName = new ComponentName(packageName, MainActivity.class.getName());
+ ComponentName componentName = new ComponentName(packageName, LOActivity.class.getName());
i.setComponent(componentName);
i.putExtra("org.libreoffice.document_provider_id", documentProvider.getId());
@@ -1149,7 +1149,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(pathString));
String packageName = this.getApplicationContext().getPackageName();
- ComponentName componentName = new ComponentName(packageName, MainActivity.class.getName());
+ ComponentName componentName = new ComponentName(packageName, LOActivity.class.getName());
intent.setComponent(componentName);
ShortcutInfo shortcut = new ShortcutInfo.Builder(this, filename)
diff --git a/android/app/src/main/res/layout/activity_show_html.xml b/android/app/src/main/res/layout/activity_show_html.xml
index e3a31a36b..af0aab261 100644
--- a/android/app/src/main/res/layout/activity_show_html.xml
+++ b/android/app/src/main/res/layout/activity_show_html.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".MainActivity">
+ tools:context="org.libreoffice.androidlib.LOActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
More information about the Libreoffice-commits
mailing list