fix up Android example project to compilation
This commit is contained in:
parent
2949553167
commit
605302a517
|
@ -16,12 +16,11 @@ import android.media.MediaMetadataRetriever;
|
|||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.MediaStore.Images;
|
||||
import android.provider.MediaStore.MediaColumns;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.GuardedAsyncTask;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
|
@ -39,23 +38,24 @@ import com.facebook.react.bridge.WritableNativeArray;
|
|||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import java.net.URLConnection;
|
||||
|
||||
// TODO #6015104: rename to something less iOSish
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* {@link NativeModule} that allows JS to interact with the photos and videos on the device (i.e.
|
||||
* {@link MediaStore.Images}).
|
||||
*/
|
||||
@ReactModule(name = CameraRollManager.NAME)
|
||||
public class CameraRollManager extends ReactContextBaseJavaModule {
|
||||
@ReactModule(name = CameraRollModule.NAME)
|
||||
public class CameraRollModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String NAME = "CameraRollManager";
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class CameraRollManager extends ReactContextBaseJavaModule {
|
|||
private static final String SELECTION_BUCKET = Images.Media.BUCKET_DISPLAY_NAME + " = ?";
|
||||
private static final String SELECTION_DATE_TAKEN = Images.Media.DATE_TAKEN + " < ?";
|
||||
|
||||
public CameraRollManager(ReactApplicationContext reactContext) {
|
||||
public CameraRollModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,19 +10,20 @@ import com.facebook.react.bridge.NativeModule;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
public class RNCCameraRollPackage implements ReactPackage {
|
||||
|
||||
public class CameraRollPackage implements ReactPackage {
|
||||
@Override
|
||||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||
return Arrays.<NativeModule>asList(new RNCCamerarollModule(reactContext));
|
||||
return Arrays.<NativeModule>asList(new CameraRollModule(reactContext));
|
||||
}
|
||||
|
||||
// Deprecated from RN 0.47
|
||||
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
||||
return Collections.emptyList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
return Collections.emptyList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
|
@ -73,10 +73,10 @@ import com.android.build.OutputFile
|
|||
*/
|
||||
|
||||
project.ext.react = [
|
||||
entryFile: "index.js"
|
||||
entryFile: "example/index.js"
|
||||
]
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
apply from: "../../../node_modules/react-native/react.gradle"
|
||||
|
||||
/**
|
||||
* Set this to true to create two separate APKs instead of one:
|
||||
|
@ -98,7 +98,7 @@ android {
|
|||
buildToolsVersion rootProject.ext.buildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.camerarollexample"
|
||||
applicationId "com.reactnativecommunity.cameraroll.camerarollexample"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
|
@ -137,6 +137,7 @@ dependencies {
|
|||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
implementation project(':react-native-cameraroll')
|
||||
}
|
||||
|
||||
// Run this once to be able to run the application with BUCK
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
buildscript {
|
||||
ext {
|
||||
buildToolsVersion = "28.0.2"
|
||||
buildToolsVersion = "28.0.3"
|
||||
minSdkVersion = 16
|
||||
compileSdkVersion = 28
|
||||
targetSdkVersion = 27
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
rootProject.name = 'CameraRollExample'
|
||||
|
||||
include ':react-native-cameraroll'
|
||||
project(':react-native-cameraroll').projectDir = new File(rootProject.projectDir, '../../android')
|
||||
// For your application the line above will most likely be:
|
||||
// project(':react-native-cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/!react-native-community/cameraroll/android')
|
||||
|
||||
include ':app'
|
||||
|
|
Loading…
Reference in New Issue