Added gradle support.
This commit is contained in:
parent
81e9383dea
commit
3c0d586509
5 changed files with 69 additions and 3 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -29,3 +29,7 @@ proguard/
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
build/
|
||||||
|
.gradle/
|
||||||
|
|
46
build.gradle
Normal file
46
build.gradle
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:0.7.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'android'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree('libs/')
|
||||||
|
compile 'com.android.support:appcompat-v7:18.0.+'
|
||||||
|
compile 'com.android.support:mediarouter-v7:18.0.+'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 19
|
||||||
|
buildToolsVersion "19.0.1"
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
|
java.srcDirs = ['src']
|
||||||
|
resources.srcDirs = ['src']
|
||||||
|
aidl.srcDirs = ['src']
|
||||||
|
renderscript.srcDirs = ['src']
|
||||||
|
res.srcDirs = ['res']
|
||||||
|
assets.srcDirs = ['assets']
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the tests to tests/java, tests/res, etc...
|
||||||
|
instrumentTest.setRoot('tests')
|
||||||
|
|
||||||
|
// Move the build types to build-types/<type>
|
||||||
|
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
||||||
|
// This moves them out of them default location under src/<type>/... which would
|
||||||
|
// conflict with src/ being used by the main source set.
|
||||||
|
// Adding new build types or product flavors should be accompanied
|
||||||
|
// by a similar customization.
|
||||||
|
debug.setRoot('build-types/debug')
|
||||||
|
release.setRoot('build-types/release')
|
||||||
|
}
|
||||||
|
}
|
6
lint.xml
Normal file
6
lint.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<lint>
|
||||||
|
<issue id="InvalidPackage">
|
||||||
|
<ignore path="libs/" />
|
||||||
|
</issue>
|
||||||
|
</lint>
|
|
@ -119,7 +119,7 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
|
||||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||||
mMediaRouterPlayService = (MediaRouterPlayServiceBinder) service;
|
mMediaRouterPlayService = (MediaRouterPlayServiceBinder) service;
|
||||||
mMediaRouterPlayService.getService().setRouterFragment(RouteFragment.this);
|
mMediaRouterPlayService.getService().setRouterFragment(RouteFragment.this);
|
||||||
mPlaylistAdapter.addAll(mMediaRouterPlayService.getService().getPlaylist());
|
mPlaylistAdapter.add(mMediaRouterPlayService.getService().getPlaylist());
|
||||||
receiveIsPlaying(mMediaRouterPlayService.getService().getCurrentTrack());
|
receiveIsPlaying(mMediaRouterPlayService.getService().getCurrentTrack());
|
||||||
applyColors();
|
applyColors();
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
mRouteAdapter = new RouteAdapter(getActivity());
|
mRouteAdapter = new RouteAdapter(getActivity());
|
||||||
mRouteAdapter.addAll(MediaRouter.getInstance(getActivity()).getRoutes());
|
mRouteAdapter.add(MediaRouter.getInstance(getActivity()).getRoutes());
|
||||||
mRouteAdapter.remove(MediaRouter.getInstance(getActivity()).getDefaultRoute());
|
mRouteAdapter.remove(MediaRouter.getInstance(getActivity()).getDefaultRoute());
|
||||||
mPlaylistAdapter = new FileArrayAdapter(getActivity());
|
mPlaylistAdapter = new FileArrayAdapter(getActivity());
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ public class RouteFragment extends MediaRouteDiscoveryFragment implements
|
||||||
*/
|
*/
|
||||||
public void play(List<Item> playlist, int start) {
|
public void play(List<Item> playlist, int start) {
|
||||||
mPlaylistAdapter.clear();
|
mPlaylistAdapter.clear();
|
||||||
mPlaylistAdapter.addAll(playlist);
|
mPlaylistAdapter.add(playlist);
|
||||||
mMediaRouterPlayService.getService().setPlaylist(playlist);
|
mMediaRouterPlayService.getService().setPlaylist(playlist);
|
||||||
|
|
||||||
if (mSelectedRoute != null)
|
if (mSelectedRoute != null)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.github.nutomic.controldlna.utility;
|
package com.github.nutomic.controldlna.utility;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v7.media.MediaRouter.RouteInfo;
|
import android.support.v7.media.MediaRouter.RouteInfo;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -33,4 +35,12 @@ public class RouteAdapter extends ArrayAdapter<RouteInfo> {
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replacement for addAll, which is not implemented on lower API levels.
|
||||||
|
*/
|
||||||
|
public void add(List<RouteInfo> routes) {
|
||||||
|
for (RouteInfo r : routes)
|
||||||
|
add(r);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue