Permalink
Browse files

[droid] hook up android app vfs

  • Loading branch information...
1 parent 5660daa commit 73d6689053ae9375fe88a3f46cafc1cc757cdf04 Cory Fields committed Jul 27, 2012
@@ -6811,7 +6811,11 @@ msgctxt "#20243"
msgid "Android photos"
msgstr ""
-#empty strings from id 20244 to 20249
+msgctxt "#20244"
+msgid "Android Apps"
+msgstr ""
+
+#empty strings from id 20245 to 20249
msgctxt "#20250"
msgid "Party on! (videos)"
View
@@ -767,6 +767,11 @@ bool CFileItem::IsRSS() const
|| GetMimeType() == "application/rss+xml";
}
+bool CFileItem::IsAndroidApp() const
+{
+ return URIUtils::IsAndroidApp(m_strPath);
+}
+
bool CFileItem::IsStack() const
{
return URIUtils::IsStack(m_strPath);
View
@@ -148,6 +148,7 @@ class CFileItem :
bool IsVTP() const;
bool IsLiveTV() const;
bool IsRSS() const;
+ bool IsAndroidApp() const;
void RemoveExtension();
void CleanString();
View
@@ -44,6 +44,9 @@
#include "filesystem/AddonsDirectory.h"
#include "guilib/TextureManager.h"
+#if defined(TARGET_ANDROID)
+#include "filesystem/AndroidAppDirectory.h"
+#endif
using namespace std;
using namespace ADDON;
@@ -101,6 +104,9 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it
if (items.GetPath() == "special://musicplaylists/")
return new CGUIViewStateWindowMusicSongs(items);
+ if (url.GetProtocol() == "androidapp")
+ return new CGUIViewStateWindowPrograms(items);
+
if (windowId==WINDOW_MUSIC_NAV)
return new CGUIViewStateWindowMusicNav(items);
@@ -370,6 +376,25 @@ void CGUIViewState::AddAddonsSource(const CStdString &content, const CStdString
}
}
+#if defined(TARGET_ANDROID)
+void CGUIViewState::AddAndroidSource(const CStdString &content, const CStdString &label, const CStdString &thumb)
+{
+ CFileItemList items;
+ XFILE::CAndroidAppDirectory apps;
+ if (apps.GetDirectory(content, items))
+ {
+ CMediaSource source;
+ source.strPath = "androidapp://sources/" + content + "/";
+ source.strName = label;
+ if (!thumb.IsEmpty() && g_TextureManager.HasTexture(thumb))
+ source.m_strThumbnailImage = thumb;
+ source.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL;
+ source.m_ignore = true;
+ m_sources.push_back(source);
+ }
+}
+#endif
+
void CGUIViewState::AddLiveTVSources()
{
VECSOURCES *sources = g_settings.GetSourcesFromType("video");
View
@@ -72,6 +72,9 @@ class CGUIViewState
\param thumb the skin image to use as the icon
*/
void AddAddonsSource(const CStdString &content, const CStdString &label, const CStdString& thumb);
+#if defined(TARGET_ANDROID)
+ void AddAndroidSource(const CStdString &content, const CStdString &label, const CStdString& thumb);
+#endif
void AddLiveTVSources();
void AddSortMethod(SORT_METHOD sortMethod, int buttonLabel, LABEL_MASKS labelmasks);
View
@@ -174,7 +174,8 @@ void CURL::Parse(const CStdString& strURL1)
if(m_strProtocol.Equals("rss") ||
m_strProtocol.Equals("rar") ||
m_strProtocol.Equals("addons") ||
- m_strProtocol.Equals("image"))
+ m_strProtocol.Equals("image") ||
+ m_strProtocol.Equals("androidapp"))
sep = "?";
else
if(strProtocol2.Equals("http")
@@ -63,6 +63,9 @@ CStdString CGUIViewStateWindowPrograms::GetExtensions()
VECSOURCES& CGUIViewStateWindowPrograms::GetSources()
{
AddAddonsSource("executable", g_localizeStrings.Get(1043), "DefaultAddonProgram.png");
+#if defined(TARGET_ANDROID)
+ AddAndroidSource("apps", g_localizeStrings.Get(20244), "DefaultProgram.png");
+#endif
AddOrReplace(g_settings.m_programSources,CGUIViewState::GetSources());
return g_settings.m_programSources;
}
View
@@ -812,6 +812,11 @@ bool URIUtils::IsBluray(const CStdString& strFile)
return strFile.Left(7).Equals("bluray:");
}
+bool URIUtils::IsAndroidApp(const CStdString &path)
+{
+ return path.Left(11).Equals("androidapp:");
+}
+
bool URIUtils::IsDOSPath(const CStdString &path)
{
if (path.size() > 1 && path[1] == ':' && isalpha(path[0]))
View
@@ -91,6 +91,7 @@ class URIUtils
static bool IsAPK(const CStdString& strFile);
static bool IsZIP(const CStdString& strFile);
static bool IsBluray(const CStdString& strFile);
+ static bool IsAndroidApp(const CStdString& strFile);
static void AddSlashAtEnd(CStdString& strFolder);
static bool HasSlashAtEnd(const CStdString& strFile);
@@ -64,6 +64,9 @@
#include "interfaces/python/XBPython.h"
#endif
#include "interfaces/Builtins.h"
+#if defined(TARGET_ANDROID)
+#include "xbmc/android/activity/XBMCApp.h"
+#endif
#define CONTROL_BTNVIEWASICONS 2
#define CONTROL_BTNSORTBY 3
@@ -948,6 +951,14 @@ bool CGUIMediaWindow::OnClick(int iItem)
{
return XFILE::CPluginDirectory::RunScriptWithParams(pItem->GetPath());
}
+#if defined(TARGET_ANDROID)
+ else if (pItem->IsAndroidApp())
+ {
+ CStdString appName = URIUtils::GetFileName(pItem->GetPath());
+ CLog::Log(LOGDEBUG, "CGUIMediaWindow::OnClick Trying to run: %s",appName.c_str());
+ return CXBMCApp::StartActivity(appName);
+ }
+#endif
else
{
m_iSelectedItem = m_viewControl.GetSelectedItem();

0 comments on commit 73d6689

Please sign in to comment.