Use system haptic feedback instead of custom vibration; enable on short press

Closes #66
pull/77/merge
Alinson S. Xavier 10 years ago
parent 6c810ee7a3
commit 1ef4f8d456

@ -24,8 +24,6 @@
android:versionCode="13" android:versionCode="13"
android:versionName="1.3.3"> android:versionName="1.3.3">
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission <uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE" android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18" /> android:maxSdkVersion="18" />

@ -30,6 +30,7 @@ import android.support.annotation.Nullable;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -322,7 +323,6 @@ public class ListHabitsFragment extends Fragment
if (isShortToggleEnabled) return; if (isShortToggleEnabled) return;
toggleCheck(v); toggleCheck(v);
DialogHelper.vibrate(activity, 100);
} }
private void toggleCheck(View v) private void toggleCheck(View v)
@ -335,6 +335,8 @@ public class ListHabitsFragment extends Fragment
Habit habit = loader.habits.get(tag); Habit habit = loader.habits.get(tag);
if(habit == null) return; if(habit == null) return;
listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
helper.toggleCheckmarkView(v, habit); helper.toggleCheckmarkView(v, habit);
executeCommand(new ToggleRepetitionCommand(habit, timestamp), habit.getId()); executeCommand(new ToggleRepetitionCommand(habit, timestamp), habit.getId());
} }

@ -52,13 +52,6 @@ public abstract class DialogHelper
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
} }
public static void vibrate(Context context, int duration)
{
Vibrator vb = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
vb.vibrate(duration);
}
public static void incrementLaunchCount(Context context) public static void incrementLaunchCount(Context context)
{ {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

@ -190,6 +190,7 @@ public class ListHabitsHelper
btCheck.setTypeface(fontawesome); btCheck.setTypeface(fontawesome);
btCheck.setOnLongClickListener(onLongClickListener); btCheck.setOnLongClickListener(onLongClickListener);
btCheck.setOnClickListener(onClickListener); btCheck.setOnClickListener(onClickListener);
btCheck.setHapticFeedbackEnabled(false);
((LinearLayout) view.findViewById(R.id.llButtons)).addView(check); ((LinearLayout) view.findViewById(R.id.llButtons)).addView(check);
} }

Loading…
Cancel
Save