You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement passing a URI to open inside the application
Supported URI schemes will also be added to the .desktop file for --install The URI is passed as named parameter --uri. This allows us to use unnamed parameters for split APK apps in the future
This commit is contained in:
@@ -4,6 +4,7 @@ import android.os.Bundle;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.pm.PackageParser;
|
||||
|
||||
public class Application extends ContextWrapper {
|
||||
public long native_window;
|
||||
@@ -16,6 +17,21 @@ public class Application extends ContextWrapper {
|
||||
return getString(pkg.applicationInfo.labelRes);
|
||||
}
|
||||
|
||||
String get_supported_mime_types() {
|
||||
String mimeTypes = "";
|
||||
for (PackageParser.Activity activity: pkg.activities) {
|
||||
for (PackageParser.IntentInfo intent: activity.intents) {
|
||||
for (int i = 0; i < intent.countDataSchemes(); i++) {
|
||||
String scheme = intent.getDataScheme(i);
|
||||
// ignore http and https, as there is no way to only handle specific hosts in a .desktop file
|
||||
if (!"http".equals(scheme) && !"https".equals(scheme))
|
||||
mimeTypes += "x-scheme-handler/" + intent.getDataScheme(i) + ";";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "".equals(mimeTypes) ? null : mimeTypes;
|
||||
}
|
||||
|
||||
public interface ActivityLifecycleCallbacks {
|
||||
void onActivityCreated(Activity activity, Bundle savedInstanceState);
|
||||
void onActivityStarted(Activity activity);
|
||||
|
||||
Reference in New Issue
Block a user