[Android] Initial commit
This commit is contained in:
parent
826218017d
commit
0a3fdd912b
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,3 +6,5 @@ Examples/VideoPlayer/VideoPlayer.xcodeproj/project.xcworkspace/**/*
|
|||||||
Examples/VideoPlayer/VideoPlayer.xcodeproj/xcuserdata/**/*
|
Examples/VideoPlayer/VideoPlayer.xcodeproj/xcuserdata/**/*
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
build/
|
||||||
|
*.iml
|
||||||
|
20
android/build.gradle
Normal file
20
android/build.gradle
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 23
|
||||||
|
buildToolsVersion "23.0.1"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 16
|
||||||
|
targetSdkVersion 22
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
ndk {
|
||||||
|
abiFilters "armeabi-v7a", "x86"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'com.facebook.react:react-native:0.13.+'
|
||||||
|
}
|
3
android/src/main/AndroidManifest.xml
Normal file
3
android/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.brentvatne.RCTVideo">
|
||||||
|
</manifest>
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.brentvatne.react;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
|
import com.facebook.react.bridge.JavaScriptModule;
|
||||||
|
import com.facebook.react.bridge.NativeModule;
|
||||||
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
import com.facebook.react.uimanager.ViewManager;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ReactVideoPackage implements ReactPackage {
|
||||||
|
|
||||||
|
private Activity mActivity = null;
|
||||||
|
|
||||||
|
public ReactVideoPackage(Activity activity) {
|
||||||
|
mActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||||
|
return Arrays.<ViewManager>asList(new ReactVideoViewManager(mActivity));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.brentvatne.react;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.widget.VideoView;
|
||||||
|
import com.facebook.react.bridge.ReadableMap;
|
||||||
|
import com.facebook.react.uimanager.ReactProp;
|
||||||
|
import com.facebook.react.uimanager.SimpleViewManager;
|
||||||
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
|
|
||||||
|
public class ReactVideoViewManager extends SimpleViewManager<VideoView> {
|
||||||
|
|
||||||
|
public static final String REACT_CLASS = "RCTVideo";
|
||||||
|
private static final String PROP_SRC = "src";
|
||||||
|
|
||||||
|
private Activity mActivity = null;
|
||||||
|
|
||||||
|
public ReactVideoViewManager(Activity activity) {
|
||||||
|
mActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return REACT_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected VideoView createViewInstance(ThemedReactContext themedReactContext) {
|
||||||
|
return new VideoView(themedReactContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = PROP_SRC)
|
||||||
|
public void setSrc(VideoView videoView, @Nullable ReadableMap src) {
|
||||||
|
videoView.setVideoURI(Uri.parse(src.getString("uri")));
|
||||||
|
}
|
||||||
|
}
|
8
android/src/main/res/values/styles.xml
Normal file
8
android/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
Loading…
Reference in New Issue
Block a user