From 917df3d6c3416ab2911a44b4d290fac8ca3531b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Sun, 18 Dec 2016 13:43:07 +0100 Subject: [PATCH] Android 19 - No resource found [Fixes #97] --- plugin.xml | 1 - src/android/reflect/Meta.java | 4 ++++ src/android/ui/SelectPrinterActivity.java | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 915c74e..ca85dc7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -78,7 +78,6 @@ diff --git a/src/android/reflect/Meta.java b/src/android/reflect/Meta.java index e5aea82..83eeba9 100644 --- a/src/android/reflect/Meta.java +++ b/src/android/reflect/Meta.java @@ -137,6 +137,10 @@ public abstract class Meta { int resId; resId = res.getIdentifier(name, type, pkgName); + if (resId == 0) { + resId = Resources.getSystem().getIdentifier(name, type, "android"); + } + return resId; } } diff --git a/src/android/ui/SelectPrinterActivity.java b/src/android/ui/SelectPrinterActivity.java index 3470b3a..f45a464 100644 --- a/src/android/ui/SelectPrinterActivity.java +++ b/src/android/ui/SelectPrinterActivity.java @@ -28,6 +28,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; +import android.os.Build; import android.os.Bundle; import android.print.PrinterId; import android.print.PrinterInfo; @@ -85,6 +86,11 @@ public final class SelectPrinterActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (Build.VERSION.SDK_INT >= 21) { + setTheme(Meta.getResId( + this, "style", "Theme.Material.Settings")); + } + setContentView(Meta.getResId( this, "layout", "select_printer_activity"));