OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.content.browser; | |
6 | |
7 import android.content.Context; | |
8 import android.os.Vibrator; | |
9 | |
10 import org.chromium.base.CalledByNative; | |
11 import org.chromium.base.JNINamespace; | |
12 | |
13 @JNINamespace("content") | |
14 class VibrationService { | |
15 | |
16 private Vibrator mVibrator; | |
Peter Beverloo
2013/06/13 11:27:45
This can be final.
Michael van Ouwerkerk
2013/06/18 14:39:23
Done.
| |
17 | |
18 @CalledByNative | |
19 public static VibrationService create(Context context) { | |
20 return new VibrationService(context); | |
21 } | |
22 | |
23 @CalledByNative | |
24 public void vibrate(int time) { | |
25 mVibrator.vibrate(time); | |
26 } | |
27 | |
28 @CalledByNative | |
29 public void cancelVibration() { | |
30 mVibrator.cancel(); | |
31 } | |
32 | |
33 private VibrationService(Context context) { | |
34 mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE ); | |
35 } | |
36 } | |
OLD | NEW |