diff --git a/playback/player/android/AndroidManifest.xml b/playback/player/android/AndroidManifest.xml deleted file mode 100644 index 8b156d49d0..0000000000 --- a/playback/player/android/AndroidManifest.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/playback/player/android/Makefile.am b/playback/player/android/Makefile.am index 2664abbab9..e9e4c74615 100644 --- a/playback/player/android/Makefile.am +++ b/playback/player/android/Makefile.am @@ -1,10 +1,24 @@ EXTRA_DIST = \ - AndroidManifest.xml \ - jni/Android.mk \ - jni/player.c \ - res/layout/main.xml \ - res/values/strings.xml \ - src/org/freedesktop/gstreamer/Player.java \ - src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java \ - src/org/freedesktop/gstreamer/player/Play.java - + build.gradle \ + gradlew \ + gradlew.bat \ + README.md \ + settings.gradle \ + app/build.gradle \ + app/src/main/AndroidManifest.xml \ + app/src/main/java/org/freedesktop/gstreamer/Player.java \ + app/src/main/java/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java \ + app/src/main/java/org/freedesktop/gstreamer/player/Play.java \ + app/src/main/java/org/freedesktop/gstreamer/player/VideoSelector.java \ + app/src/main/jni/Android.mk \ + app/src/main/jni/Application.mk \ + app/src/main/jni/player.c \ + app/src/main/res/layout/activity_player.xml \ + app/src/main/res/layout/activity_video_selector.xml \ + app/src/main/res/menu/menu_video_selector.xml \ + app/src/main/res/values/dimens.xml \ + app/src/main/res/values/strings.xml \ + app/src/main/res/values/styles.xml \ + app/src/main/res/values-w820dp/styles.xml \ + gradle/wrapper/gradle-wrapper.jar \ + gradle/wrapper/gradle-wrapper.properties \ No newline at end of file diff --git a/playback/player/android/README.md b/playback/player/android/README.md new file mode 100644 index 0000000000..cf331f7b97 --- /dev/null +++ b/playback/player/android/README.md @@ -0,0 +1,50 @@ +GST Player Android port +======================= + +Prerequisites +------------- + +1. Install Android SDK from https://developer.android.com/sdk/ & set `sdk.dir` in **local.properties** to the installation path +2. Install Android NDK from https://developer.android.com/tools/sdk/ndk/index.html & set `ndk.dir` in **local.properties** to the installation path +3. If you have a different special directory for pkg-config or other tools (e.g. on OSX when using Homebrew), then also set this path using the `ndk.extraPath` variable in **local.properties** +4. Download the GStreamer android ports http://gstreamer.freedesktop.org/data/pkg/android/ and set `gstreamer.$ABI.dir` properties in **local.properties**: + + gstreamer.arm.dir=/path/to/gstreamer-1.0-android-arm-release-1.4.5/ + gstreamer.armv7.dir=/path/to/gstreamer-1.0-android-armv7-release-1.4.5/ + gstreamer.x86.dir=/path/to/gstreamer-1.0-android-x86-release-1.4.5/ + +Compiling the sample +-------------------- + +Use + + ./gradlew installDebug + +to compile and install a debug version onto all connected devices. + +Please note this component is using the new Android build system based on Gradle. More information about this is available on http://tools.android.com/tech-docs/new-build-system. + +Android Studio +-------------- + +Android Studio builds will work out of the box. Simply open `build.gradle` in this folder to import the project. + +Manual NDK build +---------------- + +It is still possible to build just the NDK portion. This will speed up the process a bit as you don't need to start gradle first and compile the complete App. +First, make sure to set `NDK_PROJECT_PATH` to this projects main source path. Additionally the SDK & NDK tools are available in `$PATH`. + + export NDK_PROJECT_PATH=$PWD/app/src/main + +Second, set the following environment variables to the GStreamer installation folders: + + export GSTREAMER_ROOT_ARM=/path/to/gstreamer-1.0-android-arm-release-1.4.5/ + export GSTREAMER_ROOT_ARMV7=/path/to/tmp/gstreamer-1.0-android-armv7-release-1.4.5/ + export GSTREAMER_ROOT_X86=/path/to/gstreamer-1.0-android-x86-release-1.4.5/ + +If you don't want to build all architectures, please modify the file `app/src/main/jni/Application.mk` + +Finally, within the `app/src/main/` directory, invoke: + + ndk-build \ No newline at end of file diff --git a/playback/player/android/app/app.iml b/playback/player/android/app/app.iml new file mode 100644 index 0000000000..86e3b56426 --- /dev/null +++ b/playback/player/android/app/app.iml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/playback/player/android/app/build.gradle b/playback/player/android/app/build.gradle new file mode 100644 index 0000000000..6039b5bd7c --- /dev/null +++ b/playback/player/android/app/build.gradle @@ -0,0 +1,68 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "org.freedesktop.gstreamer.play" + minSdkVersion 9 + targetSdkVersion 22 + + ndk { + moduleName "gstplayer" + } + } + + sourceSets { + main { + // GStreamer will generate these files. + java { + srcDir 'src/main/jni/src' + } + assets { + srcDir 'src/main/jni/assets' + } + + //Tell Gradle where to put the compiled shared library + jniLibs.srcDir 'src/main/libs' + + //disable automatic ndk-build call + jni.srcDirs = []; + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } + + // Thank you http://stackoverflow.com/q/28878689/375209 + tasks.withType(JavaCompile) { + compileTask -> compileTask.dependsOn ndkBuild + } + + task ndkBuild(type: Exec) { + Properties properties = new Properties() + properties.load(project.rootProject.file('local.properties').newDataInputStream()) + def ndkDir = properties.getProperty('ndk.dir') + environment GSTREAMER_ROOT_ARM: properties.getProperty('gstreamer.arm.dir') + environment GSTREAMER_ROOT_ARMV7: properties.getProperty('gstreamer.armv7.dir') + environment GSTREAMER_ROOT_X86: properties.getProperty('gstreamer.x86.dir') + + def ndkExtraPath = properties.getProperty('ndk.extraPath') + if (! "".equalsIgnoreCase(ndkExtraPath)) { + environment PATH: "${System.getenv("PATH")}${File.pathSeparator}${ndkExtraPath}" + } + + commandLine "${ndkDir}/ndk-build", '-C', file('src/main/jni').absolutePath //, 'V=1' // Enable V=1 for debugging messages. + } +} + +dependencies { + compile 'com.android.support:appcompat-v7:22.1.1' + compile "com.android.support:recyclerview-v7:22.1.1" + compile "com.android.support:support-annotations:22.1.1" +} diff --git a/playback/player/android/app/src/main/AndroidManifest.xml b/playback/player/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..6de668cec0 --- /dev/null +++ b/playback/player/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/playback/player/android/src/org/freedesktop/gstreamer/Player.java b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/Player.java similarity index 100% rename from playback/player/android/src/org/freedesktop/gstreamer/Player.java rename to playback/player/android/app/src/main/java/org/freedesktop/gstreamer/Player.java diff --git a/playback/player/android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/GStreamerSurfaceView.java similarity index 100% rename from playback/player/android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java rename to playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/GStreamerSurfaceView.java diff --git a/playback/player/android/src/org/freedesktop/gstreamer/player/Play.java b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/Play.java similarity index 81% rename from playback/player/android/src/org/freedesktop/gstreamer/player/Play.java rename to playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/Play.java index 2874f05de5..9be9d78b2a 100644 --- a/playback/player/android/src/org/freedesktop/gstreamer/player/Play.java +++ b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/Play.java @@ -20,18 +20,13 @@ package org.freedesktop.gstreamer.play; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.PowerManager; +import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.SurfaceHolder; -import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton; @@ -42,13 +37,16 @@ import android.widget.Toast; import org.freedesktop.gstreamer.Player; -public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarChangeListener { +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class Play extends AppCompatActivity implements SurfaceHolder.Callback, OnSeekBarChangeListener { private PowerManager.WakeLock wake_lock; private Player player; @Override - public void onCreate(Bundle savedInstanceState) - { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { @@ -59,7 +57,7 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC return; } - setContentView(R.layout.main); + setContentView(R.layout.activity_player); player = new Player(); @@ -88,7 +86,7 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC player.setPositionUpdatedListener(new Player.PositionUpdatedListener() { public void positionUpdated(Player player, final long position) { - runOnUiThread (new Runnable() { + runOnUiThread(new Runnable() { public void run() { sb.setProgress((int) (position / 1000000)); updateTimeWidget(); @@ -99,7 +97,7 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC player.setDurationChangedListener(new Player.DurationChangedListener() { public void durationChanged(Player player, final long duration) { - runOnUiThread (new Runnable() { + runOnUiThread(new Runnable() { public void run() { sb.setMax((int) (duration / 1000000)); updateTimeWidget(); @@ -109,31 +107,35 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC }); final GStreamerSurfaceView gsv = (GStreamerSurfaceView) this.findViewById(R.id.surface_video); + player.setVideoDimensionsChangedListener(new Player.VideoDimensionsChangedListener() { public void videoDimensionsChanged(Player player, final int width, final int height) { - runOnUiThread (new Runnable() { + runOnUiThread(new Runnable() { public void run() { - Log.i ("GStreamer", "Media size changed to " + width + "x" + height); - gsv.media_width = width; - gsv.media_height = height; - runOnUiThread(new Runnable() { - public void run() { - gsv.requestLayout(); - } - }); + Log.i("GStreamer", "Media size changed to " + width + "x" + height); + if (width > 0 && height > 0) { + gsv.media_width = width; + gsv.media_height = height; + runOnUiThread(new Runnable() { + public void run() { + gsv.requestLayout(); + } + }); + } else { + Log.i("GStreamer", "Ignoring media size."); + } } }); } }); - SurfaceView sv = (SurfaceView) this.findViewById(R.id.surface_video); - SurfaceHolder sh = sv.getHolder(); + SurfaceHolder sh = gsv.getHolder(); sh.addCallback(this); String mediaUri = null; Intent intent = getIntent(); android.net.Uri uri = intent.getData(); - Log.i ("GStreamer", "Received URI: " + uri); + Log.i("GStreamer", "Received URI: " + uri); if (uri.getScheme().equals("content")) { android.database.Cursor cursor = getContentResolver().query(uri, null, null, null, null); cursor.moveToFirst(); @@ -152,7 +154,7 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC super.onDestroy(); } - private void updateTimeWidget () { + private void updateTimeWidget() { final TextView tv = (TextView) this.findViewById(R.id.textview_time); final SeekBar sb = (SeekBar) this.findViewById(R.id.seek_bar); final int pos = sb.getProgress(); @@ -160,14 +162,12 @@ public class Play extends Activity implements SurfaceHolder.Callback, OnSeekBarC SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("UTC")); - final String message = df.format(new Date (pos)) + " / " + df.format(new Date (max)); + final String message = df.format(new Date(pos)) + " / " + df.format(new Date(max)); tv.setText(message); } - public void surfaceChanged(SurfaceHolder holder, int format, int width, - int height) { - Log.d("GStreamer", "Surface changed to format " + format + " width " - + width + " height " + height); + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + Log.d("GStreamer", "Surface changed to format " + format + " width " + width + " height " + height); player.setSurface(holder.getSurface()); } diff --git a/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/VideoSelector.java b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/VideoSelector.java new file mode 100644 index 0000000000..38739f7d12 --- /dev/null +++ b/playback/player/android/app/src/main/java/org/freedesktop/gstreamer/play/VideoSelector.java @@ -0,0 +1,151 @@ +/* GStreamer + * + * Copyright (C) 2015 Sebastian Roth + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +package org.freedesktop.gstreamer.play; + +import android.content.Context; +import android.content.Intent; +import android.database.Cursor; +import android.net.Uri; +import android.os.Bundle; +import android.provider.MediaStore; +import android.support.v4.app.LoaderManager; +import android.support.v4.content.CursorLoader; +import android.support.v4.content.Loader; +import android.support.v4.widget.SimpleCursorAdapter; +import android.support.v7.app.AppCompatActivity; +import android.text.TextUtils; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ListView; + + +public class VideoSelector extends AppCompatActivity implements LoaderManager.LoaderCallbacks { + + VideoAdapter adapter; + boolean sortByName = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_video_selector); + + ListView videoList = (ListView) findViewById(R.id.videoList); + adapter = new VideoAdapter(this); + videoList.setAdapter(adapter); + videoList.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, final int position, final long id) { + final String videoPath = adapter.getVideoPath(position); + if (!TextUtils.isEmpty(videoPath)) { + Intent intent = new Intent(VideoSelector.this, Play.class); + intent.setData(Uri.parse("file://" + videoPath)); + startActivity(intent); + } + } + }); + + getSupportLoaderManager().initLoader(1, null, this); + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_video_selector, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_about) { + return true; + } + + //noinspection SimplifiableIfStatement + if (id == R.id.action_sort) { + sortByName = !sortByName; + getSupportLoaderManager().restartLoader(1, null, this); + return true; + } + + + return super.onOptionsItemSelected(item); + } + + @Override + public Loader onCreateLoader(int id, Bundle args) { + if (sortByName) { + return new CursorLoader(this, MediaStore.Video.Media.getContentUri("external"), null, null, null, + "UPPER(" + MediaStore.Video.Media.DATA + ")"); + } else { + return new CursorLoader(this, MediaStore.Video.Media.getContentUri("external"), null, null, null, + "UPPER(" + MediaStore.Video.Media.DISPLAY_NAME + ")"); + } + } + + @Override + public void onLoadFinished(Loader loader, Cursor data) { + adapter.swapCursor(data); + } + + @Override + public void onLoaderReset(Loader loader) { + + } + + + class VideoAdapter extends SimpleCursorAdapter { + public VideoAdapter(Context context) { + super(context, android.R.layout.simple_list_item_2, null, + new String[]{MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.DATA}, + new int[]{android.R.id.text1, android.R.id.text2}, 0); + } + + @Override + public long getItemId(int position) { + final Cursor cursor = getCursor(); + if (cursor.getCount() == 0 || position >= cursor.getCount()) { + return 0; + } + cursor.moveToPosition(position); + + return cursor.getLong(0); + } + + public String getVideoPath(int position) { + final Cursor cursor = getCursor(); + if (cursor.getCount() == 0) { + return ""; + } + cursor.moveToPosition(position); + + return cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATA)); + } + } +} diff --git a/playback/player/android/jni/Android.mk b/playback/player/android/app/src/main/jni/Android.mk similarity index 60% rename from playback/player/android/jni/Android.mk rename to playback/player/android/app/src/main/jni/Android.mk index fe4d50aaa8..7afe06251e 100644 --- a/playback/player/android/jni/Android.mk +++ b/playback/player/android/app/src/main/jni/Android.mk @@ -2,18 +2,25 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) +GST_PATH := $(LOCAL_PATH)/../../../../../ + LOCAL_MODULE := gstplayer -LOCAL_SRC_FILES := player.c ../../lib/gst/player/gstplayer.c ../../lib/gst/player/gstplayer-media-info.c -LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../lib +LOCAL_SRC_FILES := player.c \ + $(GST_PATH)/lib/gst/player/gstplayer.c \ + $(GST_PATH)/lib/gst/player/gstplayer-media-info.c +LOCAL_C_INCLUDES := $(GST_PATH)/lib LOCAL_SHARED_LIBRARIES := gstreamer_android LOCAL_LDLIBS := -llog -landroid include $(BUILD_SHARED_LIBRARY) -ifndef GSTREAMER_ROOT -ifndef GSTREAMER_ROOT_ANDROID -$(error GSTREAMER_ROOT_ANDROID is not defined!) -endif -GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID) +ifeq ($(TARGET_ARCH_ABI),armeabi) + GSTREAMER_ROOT := $(GSTREAMER_ROOT_ARM) +else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + GSTREAMER_ROOT := $(GSTREAMER_ROOT_ARMV7) +else ifeq ($(TARGET_ARCH_ABI),x86) + GSTREAMER_ROOT := $(GSTREAMER_ROOT_X86) +else + $(error Target arch ABI $(TARGET_ARCH_ABI) not supported) endif GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/ diff --git a/playback/player/android/app/src/main/jni/Application.mk b/playback/player/android/app/src/main/jni/Application.mk new file mode 100644 index 0000000000..f665244472 --- /dev/null +++ b/playback/player/android/app/src/main/jni/Application.mk @@ -0,0 +1,2 @@ +APP_ABI := armeabi armeabi-v7a x86 +APP_PLATFORM := android-9 \ No newline at end of file diff --git a/playback/player/android/jni/player.c b/playback/player/android/app/src/main/jni/player.c similarity index 99% rename from playback/player/android/jni/player.c rename to playback/player/android/app/src/main/jni/player.c index 8670b17d61..951f2c60dc 100644 --- a/playback/player/android/jni/player.c +++ b/playback/player/android/app/src/main/jni/player.c @@ -25,7 +25,7 @@ #include #include -#include "gst/player/gstplayer.h" +#include "gst/player/player.h" GST_DEBUG_CATEGORY_STATIC (debug_category); #define GST_CAT_DEFAULT debug_category diff --git a/playback/player/android/app/src/main/res/layout/activity_player.xml b/playback/player/android/app/src/main/res/layout/activity_player.xml new file mode 100644 index 0000000000..cd4a933791 --- /dev/null +++ b/playback/player/android/app/src/main/res/layout/activity_player.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/playback/player/android/app/src/main/res/layout/activity_video_selector.xml b/playback/player/android/app/src/main/res/layout/activity_video_selector.xml new file mode 100644 index 0000000000..229ae17845 --- /dev/null +++ b/playback/player/android/app/src/main/res/layout/activity_video_selector.xml @@ -0,0 +1,15 @@ + + + + diff --git a/playback/player/android/app/src/main/res/menu/menu_video_selector.xml b/playback/player/android/app/src/main/res/menu/menu_video_selector.xml new file mode 100644 index 0000000000..93f44374d6 --- /dev/null +++ b/playback/player/android/app/src/main/res/menu/menu_video_selector.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/playback/player/android/app/src/main/res/values-w820dp/dimens.xml b/playback/player/android/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000000..63fc816444 --- /dev/null +++ b/playback/player/android/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/playback/player/android/app/src/main/res/values/dimens.xml b/playback/player/android/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..47c8224673 --- /dev/null +++ b/playback/player/android/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/playback/player/android/res/values/strings.xml b/playback/player/android/app/src/main/res/values/strings.xml similarity index 70% rename from playback/player/android/res/values/strings.xml rename to playback/player/android/app/src/main/res/values/strings.xml index 9587e3c40c..d3af9a3e35 100644 --- a/playback/player/android/res/values/strings.xml +++ b/playback/player/android/app/src/main/res/values/strings.xml @@ -3,4 +3,7 @@ GStreamer Play Play Pause + + About + Sort diff --git a/playback/player/android/app/src/main/res/values/styles.xml b/playback/player/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..540f2fe87c --- /dev/null +++ b/playback/player/android/app/src/main/res/values/styles.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/playback/player/android/build.gradle b/playback/player/android/build.gradle new file mode 100644 index 0000000000..01de6eff51 --- /dev/null +++ b/playback/player/android/build.gradle @@ -0,0 +1,15 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.2.2' + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/playback/player/android/build.xml b/playback/player/android/build.xml deleted file mode 100644 index 4ef18c8f98..0000000000 --- a/playback/player/android/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/playback/player/android/gradle/wrapper/gradle-wrapper.jar b/playback/player/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..8c0fb64a86 Binary files /dev/null and b/playback/player/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/playback/player/android/gradle/wrapper/gradle-wrapper.properties b/playback/player/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..0c71e760dc --- /dev/null +++ b/playback/player/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/playback/player/android/gradlew b/playback/player/android/gradlew new file mode 100755 index 0000000000..91a7e269e1 --- /dev/null +++ b/playback/player/android/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/playback/player/android/gradlew.bat b/playback/player/android/gradlew.bat new file mode 100644 index 0000000000..8a0b282aa6 --- /dev/null +++ b/playback/player/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/playback/player/android/res/layout/main.xml b/playback/player/android/res/layout/main.xml deleted file mode 100644 index b745d8069e..0000000000 --- a/playback/player/android/res/layout/main.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/playback/player/android/settings.gradle b/playback/player/android/settings.gradle new file mode 100644 index 0000000000..e7b4def49c --- /dev/null +++ b/playback/player/android/settings.gradle @@ -0,0 +1 @@ +include ':app'