Skip to content

Commit 0c22967

Browse files
committed
last fixes
1 parent 95b66b3 commit 0c22967

File tree

6 files changed

+42
-27
lines changed

6 files changed

+42
-27
lines changed
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

android/app/src/main/java/com/helpernet/P2PKitService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import android.content.Context;
66
import android.content.Intent;
77
import android.graphics.Color;
8+
import android.media.RingtoneManager;
9+
import android.net.Uri;
810
import android.util.Log;
911
import android.support.v4.app.NotificationCompat;
1012

@@ -61,9 +63,12 @@ private void pushNotification(Topic topic, String message) {
6163
Intent notificationIntent = new Intent(mainActivity, MainActivity.class);
6264
PendingIntent pendingIntent = PendingIntent.getActivity(mainActivity, 0, notificationIntent, 0);
6365

66+
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
67+
68+
6469
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mainActivity)
6570
.setSmallIcon(R.drawable.notification_icon)
66-
// .setSound()
71+
.setSound(alarmSound)
6772
.setColor(Color.rgb(250, 0, 0))
6873
.setVibrate(new long[]{0, 900, 500, 900, 500})
6974
.setContentIntent(pendingIntent)

index.android.js

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ var HelperNet = React.createClass({
154154
this.setState({showSettings: false});
155155
},
156156

157+
dismissModal() {
158+
this.setState({receivedEmergency: false});
159+
},
160+
157161
render() {
158162

159163
const settings = (
@@ -217,7 +221,7 @@ var HelperNet = React.createClass({
217221
const modal = (
218222
<View style={styles.emergencyReceivedContainer}>
219223
<Text style={styles.emergencyReceivedText}>
220-
There is an emergency nearby and you can help!
224+
There is an emergency nearby and you can help! {'\n\n'}
221225
{ this.state.receivedEmergencyText }
222226
</Text>
223227
<View style={styles.buttonGroup}>
@@ -229,29 +233,19 @@ var HelperNet = React.createClass({
229233
</TouchableHighlight>
230234
<TouchableHighlight
231235
style={styles.emergencyReceivedButton}
232-
onPress={this.directTo}
236+
onPress={this.dismissModal}
233237
underlayColor='#ff0000'>
234238
<Text style={styles.emergencyReceivedButtonText}>Dismiss</Text>
235239
</TouchableHighlight>
236240
</View>
237241
</View>
238242
);
239243

240-
const EmergencyView = (
244+
const EmergencyViewContent = (
241245
<View style={styles.backgroundContainer}>
242-
<View style={styles.toolbar}>
243-
<View style={styles.spaceView}/>
244-
<Text style={styles.toolbarTitle}>HelperNet</Text>
245-
<TouchableOpacity style={styles.touchableSettingsIcon}
246-
onPress={this.showSettings}>
247-
<Image
248-
style={styles.settingsIcon}
249-
source={require('image!ic_settings_white_48dp')} />
250-
</TouchableOpacity>
251-
</View>
252-
<Image
253-
style={styles.circles}
254-
source={require('image!background_circles')} />
246+
<Image
247+
style={styles.circles}
248+
source={require('image!background_circles')} />
255249
<View style={styles.buttonWrapper}>
256250
<TouchableHighlight
257251
style={styles.emergencyButton}
@@ -262,10 +256,25 @@ var HelperNet = React.createClass({
262256
</View>
263257
<View style={styles.aroundCountWrapper}>
264258
<Text style={styles.aroundCountText}>
265-
{this.state.aroundCount} person nearby.
259+
{this.state.aroundCount} people nearby.
266260
</Text>
267261
</View>
268-
{ this.state.receivedEmergency ? modal : null}
262+
</View>
263+
);
264+
265+
const EmergencyView = (
266+
<View style={styles.backgroundContainer}>
267+
<View style={styles.toolbar}>
268+
<View style={styles.spaceView}></View>
269+
<Text style={styles.toolbarTitle}>HelperNet</Text>
270+
<TouchableOpacity style={styles.touchableSettingsIcon}
271+
onPress={this.showSettings}>
272+
<Image
273+
style={styles.settingsIcon}
274+
source={require('image!ic_settings_white_48dp')} />
275+
</TouchableOpacity>
276+
</View>
277+
{ this.state.receivedEmergency ? modal : EmergencyViewContent }
269278
</View>
270279
);
271280

@@ -325,13 +334,13 @@ var styles = StyleSheet.create({
325334
padding: 20,
326335
backgroundColor: '#F5FCFF',
327336
},
328-
emergencyReceivedContainer: {
329-
marginBottom: 15,
330-
borderColor: '#e70000',
331-
borderWidth: 3,
332-
borderRadius: 8,
333-
padding: 10
334-
},
337+
// emergencyReceivedContainer: {
338+
// marginBottom: 15,
339+
// borderColor: '#e70000',
340+
// borderWidth: 3,
341+
// borderRadius: 8,
342+
// padding: 10
343+
// },
335344
numberContainer: {
336345
// padding: 10
337346
},
@@ -411,8 +420,9 @@ var styles = StyleSheet.create({
411420
left: 0,
412421
margin: 15,
413422
padding: 10,
414-
height: 120,
423+
height: 170,
415424
position: 'absolute',
425+
marginTop: 150,
416426
borderRadius: 5,
417427
backgroundColor: '#f10000'
418428
},

0 commit comments

Comments
 (0)