Merge pull request #26287 from CrystalP/ref-savefilestatejob
[xbmc.git] / xbmc / platform / android / activity / JNIXBMCTextureCache.cpp
blobecfc487e2dc2fa646b81bb881d8fbf49b7ed8504
1 /*
2 * Copyright (C) 2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "JNIXBMCTextureCache.h"
11 #include "CompileInfo.h"
12 #include "imagefiles/ImageFileURL.h"
14 #include <androidjni/Context.h>
15 #include <androidjni/jutils-details.hpp>
17 using namespace jni;
19 static std::string s_className = std::string(CCompileInfo::GetClass()) + "/XBMCTextureCache";
21 void CJNIXBMCTextureCache::RegisterNatives(JNIEnv* env)
23 jclass cClass = env->FindClass(s_className.c_str());
24 if (cClass)
26 JNINativeMethod methods[] = {
27 {"_unwrapImageURL", "(Ljava/lang/String;)Ljava/lang/String;",
28 (void*)&CJNIXBMCTextureCache::_unwrapImageURL},
31 env->RegisterNatives(cClass, methods, sizeof(methods) / sizeof(methods[0]));
35 jstring CJNIXBMCTextureCache::_unwrapImageURL(JNIEnv* env, jobject thiz, jstring image)
37 std::string strImage = jcast<std::string>(jhstring::fromJNI(image));
38 std::string responseData = IMAGE_FILES::ToCacheKey(strImage);
40 jstring jres = env->NewStringUTF(responseData.c_str());
41 return jres;