diff --git a/project/cmake/scripts/android/Install.cmake b/project/cmake/scripts/android/Install.cmake index 38658c660f..cf1c3dc6be 100644 --- a/project/cmake/scripts/android/Install.cmake +++ b/project/cmake/scripts/android/Install.cmake @@ -31,27 +31,30 @@ set(package_files strings.xml searchable.xml AndroidManifest.xml build.gradle - src/Splash.java - src/XBMCVideoView.java + src/XBMCBroadcastReceiver.java src/XBMCJsonRPC.java - src/XBMCFile.java + src/XBMCMediaSession.java + src/XBMCRecommendationBuilder.java + src/XBMCProperties.java + src/XBMCSettingsContentObserver.java + src/activities/Splash.java + src/activities/Main.java + src/activities/Service.java + src/activities/XBMCCrashHandler.java + src/activities/XBMCProjection.java + src/activities/XBMCSearchableActivity.java src/channels/SyncChannelJobService.java src/channels/SyncProgramsJobService.java src/channels/model/XBMCDatabase.java src/channels/model/Subscription.java src/channels/util/SharedPreferencesHelper.java src/channels/util/TvUtil.java - src/XBMCCrashHandler.java - src/Main.java - src/XBMCProjection.java - src/XBMCMediaSession.java src/interfaces/XBMCSurfaceTextureOnFrameAvailableListener.java src/interfaces/XBMCNsdManagerResolveListener.java src/interfaces/XBMCAudioManagerOnAudioFocusChangeListener.java src/interfaces/XBMCNsdManagerRegistrationListener.java src/interfaces/XBMCNsdManagerDiscoveryListener.java src/interfaces/XBMCInputDeviceListener.java - src/XBMCBroadcastReceiver.java src/model/TVEpisode.java src/model/Movie.java src/model/TVShow.java @@ -60,16 +63,13 @@ set(package_files strings.xml src/model/Song.java src/model/MusicVideo.java src/model/Media.java - src/XBMCSearchableActivity.java - src/XBMCRecommendationBuilder.java - src/XBMCProperties.java src/content/XBMCFileContentProvider.java src/content/XBMCMediaContentProvider.java src/content/XBMCContentProvider.java src/content/XBMCYTDLContentProvider.java - src/XBMCSettingsContentObserver.java - src/XBMCMainView.java - src/Service.java + src/content/XBMCFile.java + src/views/XBMCMainView.java + src/views/XBMCVideoView.java ) foreach(file IN LISTS package_files) configure_file(${CORE_SOURCE_DIR}/tools/android/packaging/xbmc/${file}.in diff --git a/tools/android/packaging/xbmc/AndroidManifest.xml.in b/tools/android/packaging/xbmc/AndroidManifest.xml.in index 2789795363..274173d11f 100644 --- a/tools/android/packaging/xbmc/AndroidManifest.xml.in +++ b/tools/android/packaging/xbmc/AndroidManifest.xml.in @@ -50,7 +50,7 @@ android:label="@string/app_name" android:logo="@drawable/banner"> - + @@ -165,7 +165,7 @@ android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE" /> diff --git a/tools/android/packaging/xbmc/src/KeepAliveService.java.in b/tools/android/packaging/xbmc/src/KeepAliveService.java.in deleted file mode 100644 index dbf99f9030..0000000000 --- a/tools/android/packaging/xbmc/src/KeepAliveService.java.in +++ /dev/null @@ -1,41 +0,0 @@ -package @APP_PACKAGE@; - -import android.app.Notification; -import android.app.Service; -import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.os.IBinder; -import android.support.v4.app.NotificationCompat; - -public class KeepAliveService extends Service -{ - public KeepAliveService() - { - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) - { - Bitmap icon = BitmapFactory.decodeResource(getResources(), - R.drawable.ic_recommendation_80dp); - - Notification.Builder builder = new Notification.Builder(this) - .setContentTitle(getString(R.string.app_name)) - .setContentText("@APP_NAME@ is running...") - .setSmallIcon(R.drawable.notif_icon) - .setLargeIcon(Bitmap.createScaledBitmap(icon, 128, 128, false)) - ; - - Notification notification = builder.build(); - startForeground(1, notification); - return START_STICKY; - } - - @Override - public IBinder onBind(Intent intent) - { - // TODO: Return the communication channel to the service. - throw new UnsupportedOperationException("Not implemented"); - } -} diff --git a/tools/android/packaging/xbmc/src/XBMCJsonRPC.java.in b/tools/android/packaging/xbmc/src/XBMCJsonRPC.java.in index 4252ef3622..aa5b3be4c3 100644 --- a/tools/android/packaging/xbmc/src/XBMCJsonRPC.java.in +++ b/tools/android/packaging/xbmc/src/XBMCJsonRPC.java.in @@ -24,6 +24,7 @@ import android.net.Uri; import android.provider.BaseColumns; import android.util.Log; +import @APP_PACKAGE@.activities.Splash; import @APP_PACKAGE@.content.XBMCYTDLContentProvider; import @APP_PACKAGE@.model.Album; import @APP_PACKAGE@.model.Movie; diff --git a/tools/android/packaging/xbmc/src/XBMCMediaSession.java.in b/tools/android/packaging/xbmc/src/XBMCMediaSession.java.in index 2976cf7658..645023126e 100644 --- a/tools/android/packaging/xbmc/src/XBMCMediaSession.java.in +++ b/tools/android/packaging/xbmc/src/XBMCMediaSession.java.in @@ -1,6 +1,5 @@ package @APP_PACKAGE@; -import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.media.MediaMetadata; @@ -10,8 +9,7 @@ import android.media.session.PlaybackState; import android.os.Build; import android.util.Log; -import java.util.concurrent.Callable; -import java.util.concurrent.FutureTask; +import @APP_PACKAGE@.activities.Main; import static android.media.Rating.RATING_5_STARS; diff --git a/tools/android/packaging/xbmc/src/Main.java.in b/tools/android/packaging/xbmc/src/activities/Main.java.in similarity index 98% rename from tools/android/packaging/xbmc/src/Main.java.in rename to tools/android/packaging/xbmc/src/activities/Main.java.in index 1a0e7da6f0..deca58a949 100644 --- a/tools/android/packaging/xbmc/src/Main.java.in +++ b/tools/android/packaging/xbmc/src/activities/Main.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.activities; import android.app.AlarmManager; import android.app.AlertDialog; @@ -22,7 +22,6 @@ import android.media.projection.MediaProjectionManager; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; -import android.support.media.tv.TvContractCompat; import android.text.Html; import android.util.Log; import android.view.Choreographer; @@ -31,8 +30,14 @@ import android.view.View; import android.widget.RelativeLayout; import android.widget.TextView; +import @APP_PACKAGE@.R; +import @APP_PACKAGE@.XBMCBroadcastReceiver; +import @APP_PACKAGE@.XBMCJsonRPC; +import @APP_PACKAGE@.XBMCProperties; +import @APP_PACKAGE@.XBMCSettingsContentObserver; import @APP_PACKAGE@.channels.util.TvUtil; import @APP_PACKAGE@.interfaces.XBMCInputDeviceListener; +import @APP_PACKAGE@.views.XBMCMainView; import java.text.MessageFormat; diff --git a/tools/android/packaging/xbmc/src/Service.java.in b/tools/android/packaging/xbmc/src/activities/Service.java.in similarity index 96% rename from tools/android/packaging/xbmc/src/Service.java.in rename to tools/android/packaging/xbmc/src/activities/Service.java.in index 9669d31c52..558af4a8b1 100644 --- a/tools/android/packaging/xbmc/src/Service.java.in +++ b/tools/android/packaging/xbmc/src/activities/Service.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.activities; import android.app.Notification; import android.content.Intent; @@ -6,6 +6,8 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.IBinder; +import @APP_PACKAGE@.R; + public class Service extends android.app.Service { native boolean _launchApplication(); diff --git a/tools/android/packaging/xbmc/src/Splash.java.in b/tools/android/packaging/xbmc/src/activities/Splash.java.in similarity index 99% rename from tools/android/packaging/xbmc/src/Splash.java.in rename to tools/android/packaging/xbmc/src/activities/Splash.java.in index d8a67c6710..eac24e5076 100644 --- a/tools/android/packaging/xbmc/src/Splash.java.in +++ b/tools/android/packaging/xbmc/src/activities/Splash.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.activities; import java.io.BufferedOutputStream; import java.io.File; @@ -44,6 +44,9 @@ import android.content.BroadcastReceiver; import android.content.IntentFilter; import android.os.Environment; +import @APP_PACKAGE@.R; +import @APP_PACKAGE@.XBMCProperties; + public class Splash extends Activity { @@ -797,7 +800,7 @@ public class Splash extends Activity { // Run @APP_NAME@ Intent intent = getIntent(); - intent.setClass(this, @APP_PACKAGE@.Main.class); + intent.setClass(this, Main.class); intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); startActivity(intent); @@ -819,7 +822,7 @@ public class Splash extends Activity .getRunningTasks(Integer.MAX_VALUE); for (RunningTaskInfo task : tasks) if (task.topActivity.toString().equalsIgnoreCase( - "ComponentInfo{@APP_PACKAGE@/@APP_PACKAGE@.Main}")) + "ComponentInfo{@APP_PACKAGE@/@APP_PACKAGE@.activities.Main}")) { // @APP_NAME@ already running; just activate it startXBMC(); diff --git a/tools/android/packaging/xbmc/src/XBMCCrashHandler.java.in b/tools/android/packaging/xbmc/src/activities/XBMCCrashHandler.java.in similarity index 99% rename from tools/android/packaging/xbmc/src/XBMCCrashHandler.java.in rename to tools/android/packaging/xbmc/src/activities/XBMCCrashHandler.java.in index ff1214e8a9..1334780ba7 100644 --- a/tools/android/packaging/xbmc/src/XBMCCrashHandler.java.in +++ b/tools/android/packaging/xbmc/src/activities/XBMCCrashHandler.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.activities; import android.app.Activity; import android.app.AlertDialog; @@ -19,6 +19,9 @@ import android.widget.Button; import android.widget.TextView; import android.widget.Toast; +import @APP_PACKAGE@.R; +import @APP_PACKAGE@.XBMCProperties; + import org.json.JSONObject; import java.io.BufferedReader; diff --git a/tools/android/packaging/xbmc/src/XBMCProjection.java.in b/tools/android/packaging/xbmc/src/activities/XBMCProjection.java.in similarity index 97% rename from tools/android/packaging/xbmc/src/XBMCProjection.java.in rename to tools/android/packaging/xbmc/src/activities/XBMCProjection.java.in index aa50964329..d79bd17ab7 100644 --- a/tools/android/packaging/xbmc/src/XBMCProjection.java.in +++ b/tools/android/packaging/xbmc/src/activities/XBMCProjection.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.activities; import android.graphics.Bitmap; import android.graphics.PixelFormat; @@ -11,6 +11,9 @@ import android.media.projection.MediaProjection; import android.os.Handler; import android.os.Looper; +import @APP_PACKAGE@.XBMCProperties; +import @APP_PACKAGE@.activities.Main; + import java.io.FileOutputStream; import java.nio.ByteBuffer; diff --git a/tools/android/packaging/xbmc/src/XBMCSearchableActivity.java.in b/tools/android/packaging/xbmc/src/activities/XBMCSearchableActivity.java.in similarity index 93% rename from tools/android/packaging/xbmc/src/XBMCSearchableActivity.java.in rename to tools/android/packaging/xbmc/src/activities/XBMCSearchableActivity.java.in index 5c15ae75d4..dd0cfa964a 100644 --- a/tools/android/packaging/xbmc/src/XBMCSearchableActivity.java.in +++ b/tools/android/packaging/xbmc/src/activities/XBMCSearchableActivity.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.activities; import android.content.Intent; import android.database.Cursor; @@ -10,6 +10,10 @@ import android.widget.SimpleCursorAdapter; import android.util.Log; import android.widget.ListView; +import @APP_PACKAGE@.R; +import @APP_PACKAGE@.XBMCJsonRPC; +import @APP_PACKAGE@.activities.Main; + public class XBMCSearchableActivity extends Activity { @@ -67,7 +71,7 @@ public class XBMCSearchableActivity extends Activity Intent newIntent = new Intent(origIntent.getAction(), data); newIntent.setDataAndType(data, "video/*"); - newIntent.setClass(this, @APP_PACKAGE@.Main.class); + newIntent.setClass(this, Main.class); newIntent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); startActivity(newIntent); finish(); diff --git a/tools/android/packaging/xbmc/src/channels/SyncProgramsJobService.java.in b/tools/android/packaging/xbmc/src/channels/SyncProgramsJobService.java.in index 8d7435dd87..57dd322732 100644 --- a/tools/android/packaging/xbmc/src/channels/SyncProgramsJobService.java.in +++ b/tools/android/packaging/xbmc/src/channels/SyncProgramsJobService.java.in @@ -28,7 +28,7 @@ import android.support.media.tv.PreviewProgram; import android.support.media.tv.TvContractCompat; import android.util.Log; -import @APP_PACKAGE@.Splash; +import @APP_PACKAGE@.activities.Splash; import @APP_PACKAGE@.XBMCJsonRPC; import @APP_PACKAGE@.model.Movie; import @APP_PACKAGE@.model.TVEpisode; diff --git a/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in b/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in index bbd2ce8a84..16ab784cfb 100644 --- a/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in +++ b/tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in @@ -37,7 +37,7 @@ import android.support.media.tv.ChannelLogoUtils; import android.support.media.tv.TvContractCompat; import android.util.Log; -import @APP_PACKAGE@.Splash; +import @APP_PACKAGE@.activities.Splash; import @APP_PACKAGE@.channels.SyncChannelJobService; import @APP_PACKAGE@.channels.SyncProgramsJobService; import @APP_PACKAGE@.channels.model.Subscription; diff --git a/tools/android/packaging/xbmc/src/XBMCFile.java.in b/tools/android/packaging/xbmc/src/content/XBMCFile.java.in similarity index 97% rename from tools/android/packaging/xbmc/src/XBMCFile.java.in rename to tools/android/packaging/xbmc/src/content/XBMCFile.java.in index b99fb92773..609f75b869 100644 --- a/tools/android/packaging/xbmc/src/XBMCFile.java.in +++ b/tools/android/packaging/xbmc/src/content/XBMCFile.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.content; import android.util.Log; diff --git a/tools/android/packaging/xbmc/src/content/XBMCFileContentProvider.java.in b/tools/android/packaging/xbmc/src/content/XBMCFileContentProvider.java.in index e37d925fcb..825fc3ed5d 100644 --- a/tools/android/packaging/xbmc/src/content/XBMCFileContentProvider.java.in +++ b/tools/android/packaging/xbmc/src/content/XBMCFileContentProvider.java.in @@ -7,7 +7,6 @@ import android.net.Uri; import android.os.ParcelFileDescriptor; import android.util.Log; -import @APP_PACKAGE@.XBMCFile; import @APP_PACKAGE@.XBMCJsonRPC; import @APP_PACKAGE@.model.File; diff --git a/tools/android/packaging/xbmc/src/XBMCMainView.java.in b/tools/android/packaging/xbmc/src/views/XBMCMainView.java.in similarity index 98% rename from tools/android/packaging/xbmc/src/XBMCMainView.java.in rename to tools/android/packaging/xbmc/src/views/XBMCMainView.java.in index 0be3c2bcc5..c04b3b51b7 100644 --- a/tools/android/packaging/xbmc/src/XBMCMainView.java.in +++ b/tools/android/packaging/xbmc/src/views/XBMCMainView.java.in @@ -1,4 +1,4 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.views; import android.content.Context; import android.graphics.PixelFormat; diff --git a/tools/android/packaging/xbmc/src/XBMCVideoView.java.in b/tools/android/packaging/xbmc/src/views/XBMCVideoView.java.in similarity index 96% rename from tools/android/packaging/xbmc/src/XBMCVideoView.java.in rename to tools/android/packaging/xbmc/src/views/XBMCVideoView.java.in index 233a0f275a..623f0beadc 100644 --- a/tools/android/packaging/xbmc/src/XBMCVideoView.java.in +++ b/tools/android/packaging/xbmc/src/views/XBMCVideoView.java.in @@ -1,18 +1,17 @@ -package @APP_PACKAGE@; +package @APP_PACKAGE@.views; import android.graphics.Color; import android.graphics.PixelFormat; -import android.graphics.Rect; import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.view.View; import android.widget.RelativeLayout; +import @APP_PACKAGE@.activities.Main; +import @APP_PACKAGE@.R; + import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; diff --git a/xbmc/platform/android/activity/JNIXBMCFile.cpp b/xbmc/platform/android/activity/JNIXBMCFile.cpp index 53af9e6307..473b5f1d7d 100644 --- a/xbmc/platform/android/activity/JNIXBMCFile.cpp +++ b/xbmc/platform/android/activity/JNIXBMCFile.cpp @@ -31,7 +31,7 @@ using namespace jni; -static std::string s_className = std::string(CCompileInfo::GetClass()) + "/XBMCFile"; +static std::string s_className = std::string(CCompileInfo::GetClass()) + "/content/XBMCFile"; CJNIXBMCFile::CJNIXBMCFile() : CJNIBase() diff --git a/xbmc/platform/android/activity/JNIXBMCMainView.cpp b/xbmc/platform/android/activity/JNIXBMCMainView.cpp index ec722eacde..8b9e418579 100644 --- a/xbmc/platform/android/activity/JNIXBMCMainView.cpp +++ b/xbmc/platform/android/activity/JNIXBMCMainView.cpp @@ -35,7 +35,7 @@ using namespace jni; -static std::string s_className = std::string(CCompileInfo::GetClass()) + "/XBMCMainView"; +static std::string s_className = std::string(CCompileInfo::GetClass()) + "/views/XBMCMainView"; CEvent CJNIXBMCMainView::m_surfaceCreated; CJNIXBMCMainView* CJNIXBMCMainView::m_instance = nullptr; diff --git a/xbmc/platform/android/activity/JNIXBMCVideoView.cpp b/xbmc/platform/android/activity/JNIXBMCVideoView.cpp index ddbe0006e6..44c25be947 100644 --- a/xbmc/platform/android/activity/JNIXBMCVideoView.cpp +++ b/xbmc/platform/android/activity/JNIXBMCVideoView.cpp @@ -34,7 +34,7 @@ using namespace jni; -static std::string s_className = std::string(CCompileInfo::GetClass()) + "/XBMCVideoView"; +static std::string s_className = std::string(CCompileInfo::GetClass()) + "/views/XBMCVideoView"; void CJNIXBMCVideoView::RegisterNatives(JNIEnv* env) { diff --git a/xbmc/platform/android/android_onload.cpp b/xbmc/platform/android/android_onload.cpp index 110a3daa0a..466e2ad393 100644 --- a/xbmc/platform/android/android_onload.cpp +++ b/xbmc/platform/android/android_onload.cpp @@ -49,8 +49,8 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) std::string pkgRoot = CCompileInfo::GetClass(); - std::string serviceClass = pkgRoot + "/Service"; - std::string mainClass = pkgRoot + "/Main"; + std::string serviceClass = pkgRoot + "/activities/Service"; + std::string mainClass = pkgRoot + "/activities/Main"; std::string bcReceiver = pkgRoot + "/XBMCBroadcastReceiver"; std::string settingsObserver = pkgRoot + "/XBMCSettingsContentObserver";