summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-07-24 11:48:45 -0700
committerBobby Georgescu <georgescu@google.com>2012-07-24 11:50:07 -0700
commit03cb9d26e23a97c44bb4464f0a633a56d4391a98 (patch)
treed092e1489905acb2ecd5470e5a44d09cf926e926 /src
parentd5bcc6bf262edfc2bc736e5ed1d636b30a1c44fe (diff)
downloadandroid_packages_apps_Snap-03cb9d26e23a97c44bb4464f0a633a56d4391a98.tar.gz
android_packages_apps_Snap-03cb9d26e23a97c44bb4464f0a633a56d4391a98.tar.bz2
android_packages_apps_Snap-03cb9d26e23a97c44bb4464f0a633a56d4391a98.zip
Only give haptic feedback when enabled in system settings
Bug: 6866688 Change-Id: I4e349fe666244ef5459dd591c8141768b24c910a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/ActivityState.java15
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java2
-rw-r--r--src/com/android/gallery3d/app/AlbumSetPage.java2
3 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java
index c870855c9..ca0816c8d 100644
--- a/src/com/android/gallery3d/app/ActivityState.java
+++ b/src/com/android/gallery3d/app/ActivityState.java
@@ -19,12 +19,15 @@ package com.android.gallery3d.app;
import android.app.ActionBar;
import android.app.Activity;
import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.BatteryManager;
import android.os.Bundle;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
@@ -57,6 +60,9 @@ abstract public class ActivityState {
public Intent resultData;
}
+ protected boolean mHapticsEnabled;
+ private ContentResolver mContentResolver;
+
private boolean mDestroyed = false;
private boolean mPlugged = false;
boolean mIsFinishing = false;
@@ -71,6 +77,7 @@ abstract public class ActivityState {
void initialize(GalleryActivity activity, Bundle data) {
mActivity = activity;
mData = data;
+ mContentResolver = activity.getAndroidContext().getContentResolver();
}
public Bundle getData() {
@@ -167,6 +174,14 @@ abstract public class ActivityState {
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
activity.registerReceiver(mPowerIntentReceiver, filter);
}
+
+ try {
+ mHapticsEnabled = Settings.System.getInt(mContentResolver,
+ Settings.System.HAPTIC_FEEDBACK_ENABLED) != 0;
+ } catch (SettingNotFoundException e) {
+ mHapticsEnabled = false;
+ }
+
onResume();
// the transition store should be cleared after resume;
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java
index e7736918b..ed88aed43 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -613,7 +613,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
switch (mode) {
case SelectionManager.ENTER_SELECTION_MODE: {
mActionMode = mActionModeHandler.startActionMode();
- mVibrator.vibrate(100);
+ if(mHapticsEnabled) mVibrator.vibrate(100);
break;
}
case SelectionManager.LEAVE_SELECTION_MODE: {
diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java
index aa72eb82c..b610202d9 100644
--- a/src/com/android/gallery3d/app/AlbumSetPage.java
+++ b/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -533,7 +533,7 @@ public class AlbumSetPage extends ActivityState implements
case SelectionManager.ENTER_SELECTION_MODE: {
mActionBar.disableClusterMenu(true);
mActionMode = mActionModeHandler.startActionMode();
- mVibrator.vibrate(100);
+ if(mHapticsEnabled) mVibrator.vibrate(100);
break;
}
case SelectionManager.LEAVE_SELECTION_MODE: {