Browse Source

update demo

wusuopu 8 years ago
parent
commit
45c4c5e9a8

+ 1
- 0
Demo/android/app/build.gradle View File

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

+ 3
- 1
Demo/android/app/src/main/java/com/demo/MainApplication.java View File

4
 import android.util.Log;
4
 import android.util.Log;
5
 
5
 
6
 import com.facebook.react.ReactApplication;
6
 import com.facebook.react.ReactApplication;
7
+import com.github.wusuopu.RNIdle.RNIdlePackage;
7
 import com.facebook.react.ReactInstanceManager;
8
 import com.facebook.react.ReactInstanceManager;
8
 import com.facebook.react.ReactNativeHost;
9
 import com.facebook.react.ReactNativeHost;
9
 import com.facebook.react.ReactPackage;
10
 import com.facebook.react.ReactPackage;
23
     @Override
24
     @Override
24
     protected List<ReactPackage> getPackages() {
25
     protected List<ReactPackage> getPackages() {
25
       return Arrays.<ReactPackage>asList(
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 View File

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

+ 2
- 0
Demo/android/settings.gradle View File

1
 rootProject.name = 'Demo'
1
 rootProject.name = 'Demo'
2
 
2
 
3
 include ':app'
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 View File

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

+ 1
- 18
android/src/main/java/com/github/wusuopu/RNIdle/RNIdleModule.java View File

1
 package com.github.wusuopu.RNIdle;
1
 package com.github.wusuopu.RNIdle;
2
 
2
 
3
 import android.app.Activity;
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
 import com.facebook.react.bridge.ReactApplicationContext;
6
 import com.facebook.react.bridge.ReactApplicationContext;
16
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
7
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
17
 import com.facebook.react.bridge.ReactMethod;
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
 public class RNIdleModule extends ReactContextBaseJavaModule {
10
 public class RNIdleModule extends ReactContextBaseJavaModule {
28
     public RNIdleModule(ReactApplicationContext reactContext) {
11
     public RNIdleModule(ReactApplicationContext reactContext) {