-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6e8b1dc
Showing
73 changed files
with
29,174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, | ||
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
node_modules/ | ||
.expo/ | ||
dist/ | ||
npm-debug.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
*.orig.* | ||
web-build/ | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# @generated expo-cli sync-e7dcf75f4e856f7b6f3239b3f3a7dd614ee755a8 | ||
# The following patterns were generated by expo-cli | ||
|
||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
project.xcworkspace | ||
|
||
# Android/IntelliJ | ||
# | ||
build/ | ||
.idea | ||
.gradle | ||
local.properties | ||
*.iml | ||
*.hprof | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
*.keystore | ||
!debug.keystore | ||
|
||
# Bundle artifacts | ||
*.jsbundle | ||
|
||
# CocoaPods | ||
/ios/Pods/ | ||
|
||
# Expo | ||
.expo/ | ||
web-build/ | ||
dist/ | ||
|
||
# @end expo-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
|
||
'use strict' | ||
|
||
import React, { useEffect, useState } from "react"; | ||
import { | ||
StyleSheet, SafeAreaView, View, Text, | ||
Image, Pressable, TouchableOpacity, Platform, | ||
StatusBar | ||
} from "react-native"; | ||
import Torch from "react-native-torch"; | ||
import RNShake from "react-native-shake"; | ||
|
||
import img_light_on from "./assets/icons/eco-light.png"; | ||
import img_light_off from "./assets/icons/eco-light-off.png"; | ||
|
||
const App = () => { | ||
|
||
const [lightOn, setLightOn] = useState(false) | ||
|
||
const safeAreaStyles = [styles.container, lightOn ? styles.containerToLight : null] | ||
const textStyles = [styles.text, { textAlign: "center" }, !lightOn ? { color: "lightgray" } : null] | ||
const buttonStyles = [styles.text, styles.textButton, lightOn ? styles.textButtonOff : null] | ||
|
||
const toggleLight = () => { | ||
setLightOn(state => !state) | ||
} | ||
|
||
useEffect(() => { | ||
Torch.switchState(lightOn) | ||
// console.log("LOG: lightOn = " + lightOn) | ||
}, [lightOn]) | ||
|
||
useEffect(() => { | ||
const subsc = RNShake.addListener(() => { | ||
toggleLight() | ||
}) | ||
|
||
return () => subsc.remove() | ||
}) | ||
|
||
return <SafeAreaView style={safeAreaStyles}> | ||
<StatusBar backgroundColor={'pink'} barStyle="dark-content" hidden={false} /> | ||
<View> | ||
<Text style={[textStyles, {fontSize: 26}]}> | ||
Bem vinde! | ||
</Text> | ||
<Text style={textStyles}> | ||
Chacoalhe o celular ou toque na lâmpada para {lightOn ? "apagar" : "acender"}. | ||
</Text> | ||
<TouchableOpacity onPress={toggleLight}> | ||
<Image | ||
source={lightOn ? img_light_on : img_light_off} | ||
style={[ | ||
styles.img, | ||
!lightOn ? styles.imgLightOff : null, | ||
{ | ||
minHeight: 50, | ||
minWidth: 50, | ||
marginVertical: 30, | ||
height: 180, | ||
width: 180 | ||
} | ||
]} | ||
/> | ||
</TouchableOpacity> | ||
<Pressable onPress={toggleLight}> | ||
<Text style={buttonStyles}> | ||
{lightOn ? "Apagar" : "Acender"} | ||
</Text> | ||
</Pressable> | ||
</View> | ||
</SafeAreaView> | ||
} | ||
|
||
const backColorDark = '#181818' | ||
const backColorLight = '#fbfbfb' | ||
const foreColorDark = 'lightgray' | ||
const foreColorLight = 'black' | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: backColorDark, //'#fff', | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}, | ||
containerToLight: { | ||
backgroundColor: backColorLight | ||
}, | ||
img: { | ||
resizeMode: "contain", | ||
alignSelf: "center", | ||
padding: 10 | ||
}, | ||
imgLightOff: { | ||
tintColor: foreColorDark | ||
}, | ||
text: { | ||
fontSize: 24, | ||
fontFamily: "monospace", | ||
fontWeight: "bold", | ||
color: foreColorLight, | ||
marginVertical: 10, | ||
alignSelf: "center", | ||
maxWidth: 300 | ||
}, | ||
textButton: { | ||
fontSize: 20, | ||
fontWeight: "normal", | ||
padding: 10, | ||
borderRadius: 25, | ||
backgroundColor: foreColorDark, | ||
marginVertical: 10, | ||
marginHorizontal: 20, | ||
textAlign: "center" | ||
}, | ||
textButtonOff: { | ||
backgroundColor: backColorDark, | ||
color: backColorLight | ||
}, | ||
textButtonPress: { | ||
fontWeight: "bold", | ||
borderColor: "green" | ||
} | ||
}); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Android/IntelliJ | ||
# | ||
build/ | ||
.idea | ||
.gradle | ||
local.properties | ||
*.iml | ||
*.hprof | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
*.keystore | ||
!debug.keystore | ||
|
||
# Bundle artifacts | ||
*.jsbundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# To learn about Buck see [Docs](https://buckbuild.com/). | ||
# To run your application with Buck: | ||
# - install Buck | ||
# - `npm start` - to start the packager | ||
# - `cd android` | ||
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` | ||
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck | ||
# - `buck install -r android/app` - compile, install and run application | ||
# | ||
|
||
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") | ||
|
||
lib_deps = [] | ||
|
||
create_aar_targets(glob(["libs/*.aar"])) | ||
|
||
create_jar_targets(glob(["libs/*.jar"])) | ||
|
||
android_library( | ||
name = "all-libs", | ||
exported_deps = lib_deps, | ||
) | ||
|
||
android_library( | ||
name = "app-code", | ||
srcs = glob([ | ||
"src/main/java/**/*.java", | ||
]), | ||
deps = [ | ||
":all-libs", | ||
":build_config", | ||
":res", | ||
], | ||
) | ||
|
||
android_build_config( | ||
name = "build_config", | ||
package = "com.paulobs.shake_and_light", | ||
) | ||
|
||
android_resource( | ||
name = "res", | ||
package = "com.paulobs.shake_and_light", | ||
res = "src/main/res", | ||
) | ||
|
||
android_binary( | ||
name = "app", | ||
keystore = "//android/keystores:debug", | ||
manifest = "src/main/AndroidManifest.xml", | ||
package_type = "debug", | ||
deps = [ | ||
":app-code", | ||
], | ||
) |
Oops, something went wrong.