wusuopu преди 8 години
родител
ревизия
45c4c5e9a8

+ 1
- 0
Demo/android/app/build.gradle Целия файл

@@ -126,6 +126,7 @@ android {
126 126
 }
127 127
 
128 128
 dependencies {
129
+    compile project(':react-native-idle')
129 130
     compile fileTree(dir: "libs", include: ["*.jar"])
130 131
     compile "com.android.support:appcompat-v7:23.0.1"
131 132
     compile "com.facebook.react:react-native:+"  // From node_modules

+ 3
- 1
Demo/android/app/src/main/java/com/demo/MainApplication.java Целия файл

@@ -4,6 +4,7 @@ import android.app.Application;
4 4
 import android.util.Log;
5 5
 
6 6
 import com.facebook.react.ReactApplication;
7
+import com.github.wusuopu.RNIdle.RNIdlePackage;
7 8
 import com.facebook.react.ReactInstanceManager;
8 9
 import com.facebook.react.ReactNativeHost;
9 10
 import com.facebook.react.ReactPackage;
@@ -23,7 +24,8 @@ public class MainApplication extends Application implements ReactApplication {
23 24
     @Override
24 25
     protected List<ReactPackage> getPackages() {
25 26
       return Arrays.<ReactPackage>asList(
26
-          new MainReactPackage()
27
+          new MainReactPackage(),
28
+            new RNIdlePackage()
27 29
       );
28 30
     }
29 31
   };

+ 1
- 0
Demo/android/app/src/main/res/values/strings.xml Целия файл

@@ -1,3 +1,4 @@
1 1
 <resources>
2
+
2 3
     <string name="app_name">Demo</string>
3 4
 </resources>

+ 2
- 0
Demo/android/settings.gradle Целия файл

@@ -1,3 +1,5 @@
1 1
 rootProject.name = 'Demo'
2 2
 
3 3
 include ':app'
4
+include ':react-native-idle'
5
+project(':react-native-idle').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-idle/android')

+ 4
- 0
Demo/index.android.js Целия файл

@@ -11,8 +11,12 @@ import {
11 11
   Text,
12 12
   View
13 13
 } from 'react-native';
14
+import RNIdle from 'react-native-idle'
14 15
 
15 16
 class Demo extends Component {
17
+  componentDidMount() {
18
+    RNIdle.disableIdleTimer()
19
+  }
16 20
   render() {
17 21
     return (
18 22
       <View style={styles.container}>

+ 1
- 18
android/src/main/java/com/github/wusuopu/RNIdle/RNIdleModule.java Целия файл

@@ -1,28 +1,11 @@
1 1
 package com.github.wusuopu.RNIdle;
2 2
 
3 3
 import android.app.Activity;
4
-import android.content.BroadcastReceiver;
5
-import android.content.Context;
6
-import android.content.Intent;
7
-import android.content.IntentFilter;
8
-import android.content.pm.ActivityInfo;
9
-import android.content.res.Configuration;
10
-import android.util.Log;
4
+import android.view.WindowManager;
11 5
 
12
-import com.facebook.common.logging.FLog;
13
-import com.facebook.react.bridge.Arguments;
14
-import com.facebook.react.bridge.Callback;
15 6
 import com.facebook.react.bridge.ReactApplicationContext;
16 7
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
17 8
 import com.facebook.react.bridge.ReactMethod;
18
-import com.facebook.react.bridge.WritableMap;
19
-import com.facebook.react.common.ReactConstants;
20
-import com.facebook.react.modules.core.DeviceEventManagerModule;
21
-
22
-import java.util.HashMap;
23
-import java.util.Map;
24
-
25
-import javax.annotation.Nullable;
26 9
 
27 10
 public class RNIdleModule extends ReactContextBaseJavaModule {
28 11
     public RNIdleModule(ReactApplicationContext reactContext) {