[Libreoffice-commits] online.git: android/app
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Apr 12 08:33:53 UTC 2019
android/app/src/main/java/org/libreoffice/androidapp/ui/LibreOfficeUIActivity.java | 29 ++++------
1 file changed, 14 insertions(+), 15 deletions(-)
New commits:
commit 1385f11f6eaa2d9d02d85191cd8e340df25e99ff
Author: kaishu-sahu <kaishusahu101 at gmail.com>
AuthorDate: Fri Apr 12 03:41:13 2019 +0530
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Apr 12 10:33:35 2019 +0200
android: add launcher shortcuts support for api > 24
Change-Id: Iac166e2d659ac02c204fa80957a95dd80456d0a5
Reviewed-on: https://gerrit.libreoffice.org/70613
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
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 f2dd9c608..5c23799f8 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
@@ -22,6 +22,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
+import android.graphics.drawable.Icon;
import android.hardware.usb.UsbManager;
import android.net.Uri;
import android.os.AsyncTask;
@@ -1136,21 +1137,19 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements /*Settin
//for some reason, getName uses %20 instead of space
String filename = file.getName().replace("%20", " ");
- //TODO finish adding to recents
-
-// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
-// String packageName = this.getApplicationContext().getPackageName();
-// ComponentName componentName = new ComponentName(packageName, LibreOfficeMainActivity.class.getName());
-// intent.setComponent(componentName);
-//
-// ShortcutInfo shortcut = new ShortcutInfo.Builder(this, filename)
-// .setShortLabel(filename)
-// .setLongLabel(filename)
-// .setIcon(Icon.createWithResource(this, drawable))
-// .setIntent(intent)
-// .build();
-//
-// shortcuts.add(shortcut);
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(pathString));
+ String packageName = this.getApplicationContext().getPackageName();
+ ComponentName componentName = new ComponentName(packageName, MainActivity.class.getName());
+ intent.setComponent(componentName);
+
+ ShortcutInfo shortcut = new ShortcutInfo.Builder(this, filename)
+ .setShortLabel(filename)
+ .setLongLabel(filename)
+ .setIcon(Icon.createWithResource(this, drawable))
+ .setIntent(intent)
+ .build();
+
+ shortcuts.add(shortcut);
}
shortcutManager.setDynamicShortcuts(shortcuts);
}
More information about the Libreoffice-commits
mailing list