Search in sources :

Example 26 with Vibrator

use of android.os.Vibrator in project android_frameworks_base by AOSPA.

the class BugreportProgressService method takeScreenshot.

/**
     * Takes a screenshot and save it to the given location.
     */
private static boolean takeScreenshot(Context context, String path) {
    final Bitmap bitmap = Screenshooter.takeScreenshot();
    if (bitmap == null) {
        return false;
    }
    boolean status;
    try (final FileOutputStream fos = new FileOutputStream(path)) {
        if (bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos)) {
            ((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE)).vibrate(150);
            return true;
        } else {
            Log.e(TAG, "Failed to save screenshot on " + path);
        }
    } catch (IOException e) {
        Log.e(TAG, "Failed to save screenshot on " + path, e);
        return false;
    } finally {
        bitmap.recycle();
    }
    return false;
}
Also used : Bitmap(android.graphics.Bitmap) FileOutputStream(java.io.FileOutputStream) Vibrator(android.os.Vibrator) IOException(java.io.IOException)

Example 27 with Vibrator

use of android.os.Vibrator in project Applozic-Android-SDK by AppLozic.

the class MobiComConversationFragment method vibrate.

private void vibrate() {
    try {
        Vibrator v = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
        v.vibrate(200);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Vibrator(android.os.Vibrator)

Example 28 with Vibrator

use of android.os.Vibrator in project HAR-Android by linw7.

the class BeeAndVibrateManager method vibrate.

/**
 * @param context      Context实例
 * @param milliseconds 震动时长 , 单位毫秒
 */
public static void vibrate(Context context, long milliseconds) {
    Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
    vib.vibrate(milliseconds);
}
Also used : Vibrator(android.os.Vibrator)

Example 29 with Vibrator

use of android.os.Vibrator in project xDrip by NightscoutFoundation.

the class JoH method vibrateNotice.

public static void vibrateNotice() {
    final Vibrator vibrator = (Vibrator) xdrip.getAppContext().getSystemService(VIBRATOR_SERVICE);
    long[] vibrationPattern = { 0, 500, 50, 300 };
    final int indexInPatternToRepeat = -1;
    vibrator.vibrate(vibrationPattern, indexInPatternToRepeat);
}
Also used : Vibrator(android.os.Vibrator) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 30 with Vibrator

use of android.os.Vibrator in project Signal-Android by signalapp.

the class ConversationActivity method onRecorderStarted.

@Override
public void onRecorderStarted() {
    Vibrator vibrator = ServiceUtil.getVibrator(this);
    vibrator.vibrate(20);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    audioRecorder.startRecording();
}
Also used : Vibrator(android.os.Vibrator)

Aggregations

Vibrator (android.os.Vibrator)159 Intent (android.content.Intent)15 IOException (java.io.IOException)14 Uri (android.net.Uri)12 Context (android.content.Context)10 Handler (android.os.Handler)10 View (android.view.View)10 NotificationManager (android.app.NotificationManager)8 RemoteException (android.os.RemoteException)8 ImageView (android.widget.ImageView)8 AudioManager (android.media.AudioManager)7 SettingNotFoundException (android.provider.Settings.SettingNotFoundException)6 InputDevice (android.view.InputDevice)6 TextView (android.widget.TextView)6 Activity (android.app.Activity)5 Bitmap (android.graphics.Bitmap)5 FileOutputStream (java.io.FileOutputStream)5 ExecutionException (java.util.concurrent.ExecutionException)5 ListenableFuture (org.thoughtcrime.securesms.util.concurrent.ListenableFuture)5 SuppressLint (android.annotation.SuppressLint)4